我正在将应用程序从Angular 5迁移到Angular6。目前,我相信我已经解决了大多数问题,并且在使用ng serve
或ng build main
进行构建时,它的构建符合预期。但是,当以ng build --prod main
进行构建时,出现以下错误
ERROR in : Error: Illegal State: literal maps should have been converted into functions
at _AstToIrVisitor.visitLiteralMap (/workspace/tarnished-lamp/node_modules/@angular/compiler/bundles/compiler.umd.js:15824:19)
at LiteralMap.visit (/workspace/tarnished-lamp/node_modules/@angular/compiler/bundles/compiler.umd.js:3483:28)
at ASTWithSource.visit (/workspace/tarnished-lamp/node_modules/@angular/compiler/bundles/compiler.umd.js:3598:29)
at convertPropertyBinding (/workspace/tarnished-lamp/node_modules/@angular/compiler/bundles/compiler.umd.js:15626:52)
at createHostBindingsFunction (/workspace/tarnished-lamp/node_modules/@angular/compiler/bundles/compiler.umd.js:20068:39)
at baseDirectiveFields (/workspace/tarnished-lamp/node_modules/@angular/compiler/bundles/compiler.umd.js:19754:43)
at compileComponentFromMetadata (/workspace/tarnished-lamp/node_modules/@angular/compiler/bundles/compiler.umd.js:19793:29)
at compileComponentFromRender2 (/workspace/tarnished-lamp/node_modules/@angular/compiler/bundles/compiler.umd.js:19878:19)
at /workspace/tarnished-lamp/node_modules/@angular/compiler/bundles/compiler.umd.js:21551:21
at Array.forEach (<anonymous>)
at AotCompiler._compilePartialModule (/workspace/tarnished-lamp/node_modules/@angular/compiler/bundles/compiler.umd.js:21527:24)
at /workspace/tarnished-lamp/node_modules/@angular/compiler/bundles/compiler.umd.js:21509:58
at Array.forEach (<anonymous>)
at AotCompiler.emitAllPartialModules (/workspace/tarnished-lamp/node_modules/@angular/compiler/bundles/compiler.umd.js:21509:19)
at AngularCompilerProgram._emitRender3 (/workspace/tarnished-lamp/node_modules/@angular/compiler-cli/src/transformers/program.js:252:41)
at AngularCompilerProgram.emit (/workspace/tarnished-lamp/node_modules/@angular/compiler-cli/src/transformers/program.js:235:59)
我对此有两个疑问
答案 0 :(得分:0)
从angular 6.0迁移到7.0后,我启用了ivy编译器,并且遇到了相同的错误。 禁用常春藤选项,AOT构建将再次起作用。