ionic-team / ionic-team/ionic-framework

bug: Failed to fetch dynamically imported module after updating to new Angular build system

未关闭
#30,092 5 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
triage
主要语言
TypeScript
星标
52.7k
派生
13.3k
平均合并
1 天 15 小时
30 天内合并 PR
51

描述

### Prerequisites

- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.

### Ionic Framework Version

v8.x

### Current Behavior

After updating to the latest version of Ionic 8.4.1 and migrating to Angular 17, if you switch to Angular's new "application" build system, the build runs successfully. However, when running the command ionic serve, the application starts but displays a blank screen. Upon inspecting the console, the following errors can be observed:

```
Failed to load resource: the server responded with a status of 504 (Outdated Optimize Dep)
:8100/@fs/D:/_git/MyProject/Bitbucket/MyApp/.angular/cache/17.3.11/vite/deps/ion-split-pane.entry.js?import:1


Failed to load resource: the server responded with a status of 504 (Outdated Optimize Dep)
:8100/@fs/D:/_git/MyProject/Bitbucket/MyApp/.angular/cache/17.3.11/vite/deps/ion-menu_3.entry.js?import:1


Failed to load resource: the server responded with a status of 504 (Outdated Optimize Dep)
index-28849c61.js:4 TypeError: Failed to fetch dynamically imported module: http://localhost:8100/@fs/D:/_git/MyProject/Bitbucket/MyApp/.angular/cache/17.3.11/vite/deps/ion-app_8.entry.js?import undefined
consoleError @ index-28849c61.js:4
zone.js:1046 Error: Constructor for "ion-content#undefined" was not found
at index-28849c61.js:5:25555
at step (tslib.es6.mjs:147:21)
at Object.next (tslib.es6.mjs:128:51)
at fulfilled (tslib.es6.mjs:118:56)
at _ZoneDelegate.invoke (zone.js:368:26)
at Zone2.run (zone.js:129:43)
at zone.js:1257:36
at _ZoneDelegate.invokeTask (zone.js:402:31)
at Zone2.runTask (zone.js:173:47)
at drainMicroTaskQueue (zone.js:581:35)
api.onUnhandledError @ zone.js:1046
index-28849c61.js:4 TypeError: Failed to fetch dynamically imported module: http://localhost:8100/@fs/D:/_git/MyProject/Bitbucket/MyApp/.angular/cache/17.3.11/vite/deps/ion-app_8.entry.js?import undefined
consoleError @ index-28849c61.js:4
zone.js:1046 Error: Constructor for "ion-router-outlet#undefined" was not found
at index-28849c61.js:5:25555
at step (tslib.es6.mjs:147:21)
at Object.next (tslib.es6.mjs:128:51)
at fulfilled (tslib.es6.mjs:118:56)
at _ZoneDelegate.invoke (zone.js:368:26)
at Zone2.run (zone.js:129:43)
at zone.js:1257:36
at _ZoneDelegate.invokeTask (zone.js:402:31)
at Zone2.runTask (zone.js:173:47)
at drainMicroTaskQueue (zone.js:581:35)
api.onUnhandledError @ zone.js:1046
index-28849c61.js:4 TypeError: Failed to fetch dynamically imported module: http://localhost:8100/@fs/D:/_git/MyProject/Bitbucket/MyApp/.angular/cache/17.3.11/vite/deps/ion-app_8.entry.js?import undefined
consoleError @ index-28849c61.js:4
zone.js:1046 Error: Constructor for "ion-header#undefined" was not found
at index-28849c61.js:5:25555
at step (tslib.es6.mjs:147:21)
at Object.next (tslib.es6.mjs:128:51)
at fulfilled (tslib.es6.mjs:118:56)
at _ZoneDelegate.invoke (zone.js:368:26)
at Zone2.run (zone.js:129:43)
at zone.js:1257:36
at _ZoneDelegate.invokeTask (zone.js:402:31)
at Zone2.runTask (zone.js:173:47)
at drainMicroTaskQueue (zone.js:581:35)
```

### Expected Behavior

Serve the app with the new build system.

### Steps to Reproduce

Update an older app to Ionic 8;
Update Angular to at least Angular 17;
Migrate to the new build system "@angular-devkit/build-angular:application".

### Code Reproduction URL

no link

### Ionic Info

Ionic:

Ionic CLI : 7.2.0 (C:\Users\hsantos\AppData\Roaming\nvm\v22.12.0\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 8.4.1
@angular-devkit/build-angular : 17.3.11
@angular-devkit/schematics : 17.3.11
@angular/cli : 17.3.11
@ionic/angular-toolkit : 12.1.1

Capacitor:

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

Utility:

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

System:

NodeJS : v22.12.0 (C:\Program Files\nodejs\node.exe)
npm : 10.9.0
OS : Windows 10

### Additional Information

_No response_

贡献指南

打开贡献指南

调研方向

Start by reproducing the blank screen with Angular 17's @angular-devkit/build-angular:application configuration and the `ionic serve` command, then inspect the Vite optimized dependencies under `.angular/cache`. Done means the migrated Ionic 8 app serves successfully without 504 Outdated Optimize Dep errors or failed dynamic imports.

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript, vite
领域
build-system, frontend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
32/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。