Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Compiled files issue with angular 19 #30100

Open
3 tasks done
devilalex505 opened this issue Dec 23, 2024 · 3 comments
Open
3 tasks done

bug: Compiled files issue with angular 19 #30100

devilalex505 opened this issue Dec 23, 2024 · 3 comments
Labels

Comments

@devilalex505
Copy link

devilalex505 commented Dec 23, 2024

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

When I use the compiled file from www, i can't run the project.
If go on the browser, I have this error :
"NullInjectorError: No provider for ho!"

Expected Behavior

If i go on the browser, with the compiled files, the app works normally.

Steps to Reproduce

  1. Install the last ionic/cli
    npm uninstall -g ionic
    npm install -g ionic

  2. ionic start a starter project (example : tabs)

  3. run ionic build

  4. add a simple file inside the /www folder after the build (run.js) :

`const express = require('express');
const path = require('path');
const app = express();

/**

  • Instead of build provide your build directory.
    */
    app.use(express.static(path.join(__dirname, '')));

app.get('/*', function (req, res) {
res.sendFile(path.join(__dirname, '', 'index.html'));
});

var server = app.listen(9000, () => {
var port = server.address().port;
console.log('App listening at http://localhost:' + port);
require('child_process').exec(start http://localhost:${server.address().port});
});`

  1. execute "node run.js"

  2. open the browser and try the app. Then observe the issue.

  3. Bonus : If you add in the angular.json file "optimization:false" to the production configuration so it works. I think the problem come from the "uglification"

Code Reproduction URL

https://github.com/devilalex505/test-ez0kwm

Ionic Info

Ionic:

Ionic CLI : 7.2.0
Ionic Framework : @ionic/angular 8.4.1
@angular-devkit/build-angular : 19.0.6
@angular-devkit/schematics : 19.0.6
@angular/cli : 19.0.6
@ionic/angular-toolkit : 12.1.1

Capacitor:

Capacitor CLI : 6.2.0
@capacitor/android : 6.2.0
@capacitor/core : 6.2.0
@capacitor/ios : not installed

Utility:

cordova-res : not installed globally
native-run : 2.0.1

System:

NodeJS : v20.11.0
npm : 10.2.4
OS : Windows 10

Additional Information

https://stackblitz.com/~/github.com/devilalex505/test-ez0kwm
1 . ng build
2 . node run.js

bug

If downgrade angular to v18, no issue

@ionitron-bot ionitron-bot bot added the triage label Dec 23, 2024
@devilalex505
Copy link
Author

I created a stackblitz :

https://stackblitz.com/~/github.com/devilalex505/test-ez0kwm
1 . ng build
2 . node run.js

@devilalex505 devilalex505 changed the title bug: Compilated files issue with angular 19 bug: Compiled files issue with angular 19 Dec 23, 2024
@technbuzz
Copy link

May be no official support for version 19 yet

@kinggolf
Copy link

@devilalex505 I am seeing the same error. I can do non-production builds and ionic serve just fine. But production builds fail.

NullInjectorError: R3InjectorError(Platform: core)[i -> Os]: 
  NullInjectorError: No provider for Os!
⚡️  URL: capacitor://localhost/main.08517015048d961f.js
⚡️  [error] - {"name":"NullInjectorError","ngTempTokenPath":null,"ngTokenPath":["i","Os"]}
⚡️  main.08517015048d961f.js:1:1473064

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants