简体   繁体   English

错误TS5023:未知的编译器选项'enableIvy'

[英]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: truesrc/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 . compilerOptionsangularCompilerOptionstsconfig.json两个单独的性质。 You need to add "enableIvy": true to angularCompilerOptions and not compilerOptions : 您需要添加"enableIvy": trueangularCompilerOptions而不是compilerOptions

tsconfig.json: tsconfig.json:

{
  "compilerOptions": {
  ....
  },
  "angularCompilerOptions": {
    "enableIvy": true
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误 TS5023:未知的编译器选项“compilerOptions” - error TS5023: Unknown compiler option 'compilerOptions' 错误TS5023:未知的编译器选项'p' - error TS5023: Unknown compiler option 'p' 错误 TS5023:未知的编译器选项“strictTemplates” - error TS5023: Unknown compiler option 'strictTemplates' 未知的编译器选项“noImplicitOverride” - Unknown compiler option 'noImplicitOverride' 未知的编译器选项'noStrictGenericChecks' - Unknown compiler option 'noStrictGenericChecks' TSConfig 未知编译器选项“lib” - TSConfig Unknown compiler option 'lib' 发生未处理的异常:错误 TS5024:编译器选项“sourceMap”需要 boolean 类型的值 - An unhandled exception occurred: error TS5024: Compiler option 'sourceMap' requires a value of type boolean 使用 enableIvy: false 编译 Angular 9 库时会出现错误 - Compiling an Angular 9 library with enableIvy: false gives an error 从 angular 8 升级到 angular 9 时,在 tsconfig 文件中未显示 enableIvy 选项 - enableIvy option is not showing in tsconfig file while upgrading from angular 8 to angular 9 Angular 5 Service读取本地.json文件错误:未知的编译器选项'resolveJsonModule'和'esModuleInterop' - Angular 5 Service to read local .json file Error: Unknown compiler option 'resolveJsonModule' & 'esModuleInterop'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM