error TS1323: Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNex t'.
生活随笔
收集整理的這篇文章主要介紹了
error TS1323: Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNex t'.
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
找到tsconfig.json
"module": "es2015" ====> "module": "esnext",?
因為目前 Dynamic import 特性還是 esNext 的階段,而 Angular Cli 的?tsconfig?默認是 es2015,所以使用?import()?會提示這個錯誤。
這個問題發生在升級到 Angular 8.0 之后,因為這一版本更改了?loadChildren?的使用方式,新版使用了?import(),但是沒有正確更新 tsconfig,就會導致這個問題。
總結
以上是生活随笔為你收集整理的error TS1323: Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNex t'.的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 基于C++的绘图板
- 下一篇: ms sql server 2000挂起