Repository navigation
Description
Command
serve
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
22.0.9
Description
I maintain an app that our team recently migrated to Angular 22, from 17. This application uses the traditional platformBrowser().bootstrapModule(AppModule) bootstrap with IonicModule.forRoot().
We have used this for a month with no issues, but yesterday when we upgraded the CLI and core to version 22.1 (22.1.0 for core, 22.1.2 in CLI), we started getting this error in the command prompt console after opening localhost on the browser:
The file does not exist at "<project location>/.angular/cache/22.1.2/<project-name>/vite/deps/ion-app_8.entry.js" which is in the optimize deps directory. The dependency might be incompatible with the dep optimizer. Try adding it to optimizeDeps.exclude.
After inspecting .angular/cache/.../vite/deps, I observed that no ion-*.entry.js files were generated. The only Ionic-related optimized file present was @ionic_angular.js.
On rolling back to 22.0 (core 22.0.8, CLI 22.0.9), it fixed the issue.
Minimal Reproduction
I do not currently have a minimal reproduction. However, the issue occurs consistently in an NgModule-based Ionic application after upgrading Angular CLI from 22.0.9 to 22.1.2. The closest reproduction steps I can provide are:
- Create an NgModule-based Angular application.
- Add @ionic/angular (tested with 8.8.15 and 8.8.16) and configure IonicModule.forRoot().
- Upgrade Angular CLI to 22.1.2.
- Run ng serve and open the application.
Exception or Error
The file does not exist at "<project location>/.angular/cache/22.1.2/<project-name>/vite/deps/ion-app_8.entry.js" which is in the optimize deps directory. The dependency might be incompatible with the dep optimizer. Try adding it to optimizeDeps.exclude.
Your Environment
Angular CLI : 22.1.2
Angular : 22.1.0
Node.js : 24.18.0
Package Manager : npm 11.16.0
Operating System : win32 x64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 22.1.2 │ ^22.1.2 │
│ @angular/cdk │ 22.1.0 │ ^22.1.0 │
│ @angular/cli │ 22.1.2 │ ^22.1.2 │
│ @angular/common │ 22.1.0 │ ^22.1.0 │
│ @angular/compiler │ 22.1.0 │ ^22.1.0 │
│ @angular/compiler-cli │ 22.1.0 │ ^22.1.0 │
│ @angular/core │ 22.1.0 │ ^22.1.0 │
│ @angular/forms │ 22.1.0 │ ^22.1.0 │
│ @angular/localize │ 22.1.0 │ ^22.1.0 │
│ @angular/platform-browser │ 22.1.0 │ ^22.1.0 │
│ @angular/router │ 22.1.0 │ ^22.1.0 │
│ @angular/service-worker │ 22.1.0 │ ^22.1.0 │
│ rxjs │ 7.8.2 │ ~7.8.0 │
│ typescript │ 6.0.3 │ ~6.0.2 │
│ vitest │ 4.1.10 │ ^4.0.8 │
│ zone.js │ 0.16.2 │ ^0.16.2 │
└───────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?
No response
Activity
alan-agius4 commentedon Aug 6, 2026
In version 22.1, the CLI upgraded to Vite 8, which transitioned dependency prebundling from esbuild to Rolldown.
@ionic/angularand@ionic/coreare built using Stencil, which lazily loads component entry chunks using dynamic imports annotated with Vite suppression comments:/* @vite-ignore */comment. It parsed the dynamic imports as regular bundle dependencies and emitted all the correspondingion-*.entry.jschunk files directly into the.angular/cache/.../vite/deps/directory./* @vite-ignore */and leaves the import untouched as a raw runtime dynamic import without emitting or copying the referenced.entry.jsfiles intovite/deps/. When the prebundled@ionic_angular.jsmodule runs in the browser, Stencil resolves./ion-app_8.entry.jsrelative tovite/deps/(where the file does not exist), triggering the 404 error.You can resolve this by excluding
@ionic/angularand@ionic/corefrom prebundling in yourangular.jsonunder yourservetarget options:angular-automatic-lock-bot commentedon Oct 18, 2026
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.