我有一个摘要:
import { platformBrowser } from '@angular/platform-browser';
import { enableProdMode } from '@angular/core';
enableProdMode();
import '../../../src/bundle';
import {ModuleNgFactory} from './module.ngfactory';
platformBrowser().bootstrapModuleFactory(ModuleNgFactory);
尽快启用常春藤,我将遇到此错误:
Running "cory-build-aot" task
Compiling @angular/core : module as esm5
Compiling @angular/common : module as esm5
Compiling @angular/platform-browser : module as esm5
Compiling @angular/common/http : module as esm5
Compiling @angular/router : module as esm5
Compiling @angular/forms : module as esm5
Hash: d7163c5eb0d56ede4ba6
Version: webpack 4.32.2
Time: 24870ms
Built at: 05/29/2019 2:43:19 PM
4 assets
Entrypoint polyfills = polyfills.d7163c5eb0d56ede4ba6.js sourcemaps/polyfills.d7163c5eb0d56ede4ba6.js.map
Entrypoint bundle = bundle.d7163c5eb0d56ede4ba6.js sourcemaps/bundle.d7163c5eb0d56ede4ba6.js.map
[0] ./test/angular-webpack/angular/polyfills.ts 0 bytes {1} [built]
[1] ./test/angular-webpack/angular/bundle.aot.ts 0 bytes {0} [built]
ERROR in test/angular-webpack/angular/bundle.aot.ts(7,31): error TS2307: Cannot find module './module.ngfactory'.
Child html-webpack-plugin for "index.html":
1 asset
Entrypoint undefined = index.html
[0] ./node_modules/html-webpack-plugin/lib/loader.js!./test/angular-webpack/index.html 261 bytes {0} [built]
Warning: Command failed: ./node_modules/.bin/webpack-cli --color --cache --production --config /home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/corifeus-builder-angular/src/webpack.test.config.js
Compiling @angular/core : module as esm5
Compiling @angular/common : module as esm5
Compiling @angular/platform-browser : module as esm5
Compiling @angular/common/http : module as esm5
Compiling @angular/router : module as esm5
Compiling @angular/forms : module as esm5
Use --force to continue.
Aborted due to warnings.
Execution Time (2019-05-29 14:42:53 UTC+2)
cory-build-aot 25.8s ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 100%
Total 25.9s
patrikx3@workstation:~/Projects/patrikx3/corifeus/corifeus-web$
错误是什么: test / angular-webpack / angular / bundle.aot.ts(7,31)中的错误:错误TS2307:找不到模块“ ./module.ngfactory”。
我尝试通过添加angularCompilerOptions部分使enableIvy为true来启用常春藤,那就是当我收到此错误时。
答案 0 :(得分:1)
常春藤不再有任何工厂。
现在不必将有关组件的元数据存储在单独的文件中,而是将信息作为静态字段存储在组件本身上。
因此,您应该将代码重构为不使用依赖于ngfactory的东西,例如导入docker login -u _json_key -p "$(cat ${service-account.json})" https://gcr.io
答案 1 :(得分:0)
需要在allowEmptyCodegenFiles : true
的angularCompilerOptions中添加tsconfig.app.json