dav*_*997 7 jit typescript angular
几天来我遇到了某个错误:未捕获错误:JIT 编译器不可用。将 Angular 从版本 8 升级到 12 后出现了一个问题,我运行 ng build --prod --output-path = dist 命令并构建 Angular 我没有问题,但是当我启动页面时,会弹出这个 JIT 问题。我已经尝试了堆栈溢出中的所有解决方案,就像我在 package.json 中添加的那样
scripts{
"postinstall": "ngcc --properties es5 browser module main --first-only"
}Run Code Online (Sandbox Code Playgroud)
我在 main.ts '@angular/compiler' 中添加 在“angularCompilerOptions”中的 tsconfig.json 中,我将“enableIvy”更改为 true 一篇文章说更改为 true,另一篇文章说更改为 false,但这些解决方案都不适合我。我重新安装了node_modules几次并添加了几个依赖项,但没有任何效果。这是我的 tsconfig 文件:
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "es2020",
"moduleResolution": "node",
"importHelpers": true,
"resolveJsonModule": true,
"target": "es5",
"skipLibCheck": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2015",
"dom"
],
"paths": {
// "tslib": ["../frontend/node_modules/tslib/tslib.d.ts"]
}
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"enableIvy": true,
}
}Run Code Online (Sandbox Code Playgroud)
在我的 package.json 中,我添加了这行代码:
"scripts": {
"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points"
}Run Code Online (Sandbox Code Playgroud)
在 angular.json 中,我更改了 aot: true 和 buildOptimizer: false 但它根本没有改变任何内容。在这篇文章“/sf/ask/4815866051/”中,有关于更改 Webpack 配置的答案。但我们不使用 webpack,所以我不太明白这一点。你能帮忙解决这个问题吗?
| 归档时间: |
|
| 查看次数: |
5188 次 |
| 最近记录: |