[英]error TS5023: Unknown compiler option 'enableIvy'
I am trying to add IVY to my angular 7 beta project. 我正在尝试将IVY添加到我的角度7 beta项目中。 So, I added
enableIvy: true
to src/tsconfig.app.json
in compilerOptions
section 所以,我在
compilerOptions
部分添加了enableIvy: true
到src/tsconfig.app.json
But when I run ng build --prod --aot --output-hashing none
I get below error. 但是,当我运行
ng build --prod --aot --output-hashing none
我得到以下错误。
error TS5023: Unknown compiler option 'enableIvy'.
Error: error TS5023: Unknown compiler option 'enableIvy'.
at AngularCompilerPlugin._setupOptions (/Users/k26686/aniruddh/develop/experiment/shepherd/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:112:19)
at new AngularCompilerPlugin (/Users/k26686/aniruddh/develop/experiment/shepherd/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:61:14)
at _createAotPlugin (/Users/k26686/aniruddh/develop/experiment/shepherd/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/typescript.js:41:12)
at Object.getAotConfig (/Users/k26686/aniruddh/develop/experiment/shepherd/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/typescript.js:63:19)
at BrowserBuilder.buildWebpackConfig (/Users/k26686/aniruddh/develop/experiment/shepherd/node_modules/@angular-devkit/build-angular/src/browser/index.js:81:37)
at MergeMapSubscriber.rxjs_1.of.pipe.operators_1.concatMap [as project] (/Users/k26686/aniruddh/develop/experiment/shepherd/node_modules/@angular-devkit/build-angular/src/browser/index.js:31:38)
at MergeMapSubscriber._tryNext (/Users/k26686/aniruddh/develop/experiment/shepherd/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/operators/mergeMap.js:65:27)
at MergeMapSubscriber._next (/Users/k26686/aniruddh/develop/experiment/shepherd/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/operators/mergeMap.js:55:18)
at MergeMapSubscriber.Subscriber.next (/Users/k26686/aniruddh/develop/experiment/shepherd/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/Subscriber.js:64:18)
at TapSubscriber._next (/Users/k26686/aniruddh/develop/experiment/shepherd/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/operators/tap.js:62:26)
at TapSubscriber.Subscriber.next (/Users/k26686/aniruddh/develop/experiment/shepherd/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/Subscriber.js:64:18)
at MergeMapSubscriber.notifyNext (/Users/k26686/aniruddh/develop/experiment/shepherd/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/operators/mergeMap.js:84:26)
at InnerSubscriber._next (/Users/k26686/aniruddh/develop/experiment/shepherd/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/InnerSubscriber.js:25:21)
at InnerSubscriber.Subscriber.next (/Users/k26686/aniruddh/develop/experiment/shepherd/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/Subscriber.js:64:18)
at ForkJoinSubscriber.notifyComplete (/Users/k26686/aniruddh/develop/experiment/shepherd/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/observable/forkJoin.js:79:25)
at InnerSubscriber._complete (/Users/k26686/aniruddh/develop/experiment/shepherd/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/InnerSubscriber.js:32:21)
Any one resolved this. 任何人都解决了这一点
try to include enableIvy
option under angularCompilerOptions
尝试包括
enableIvy
选项下angularCompilerOptions
"angularCompilerOptions": {
"enableIvy": true
}
Now the right way is set 现在正确的方法设定
"angularCompilerOptions": {
"enableIvy": "ngtsc"
}
this is related to the issue #23455 这与问题#23455有关
This commit adds a new compiler pipeline that isn't dependent on global analysis, referred to as 'ngtsc'.
此提交添加了一个新的编译器管道,该管道不依赖于全局分析,称为“ngtsc”。 This new compiler is accessed by running ngc with "enableIvy" set to "ngtsc".
通过运行ngc并将“enableIvy”设置为“ngtsc”来访问此新编译器。 It reuses the same initialization logic but creates a new implementation of Program which does not perform the global-level analysis that AngularCompilerProgram does.
它重用了相同的初始化逻辑,但创建了一个新的Program实现,它不执行AngularCompilerProgram所做的全局级分析。 It will be the foundation for the production Ivy compiler.
它将成为生产Ivy编译器的基础。
compilerOptions
and angularCompilerOptions
are two separate properties in tsconfig.json . compilerOptions
和angularCompilerOptions
在tsconfig.json两个单独的性质。 You need to add "enableIvy": true
to angularCompilerOptions
and not compilerOptions
: 您需要添加
"enableIvy": true
到angularCompilerOptions
而不是compilerOptions
:
tsconfig.json: tsconfig.json:
{
"compilerOptions": {
....
},
"angularCompilerOptions": {
"enableIvy": true
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.