我有一个Angular 2应用程序,我希望从JIT转换为AOT。 我做了以下事情: 的 Boot.JS
import { enableProdMode } from '@angular/core'
import { platformBrowser } from '@angular/platform-browser';
import { AppModuleNgFactory } from '../appAot/appModule.ngfactory';
enableProdMode();
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory)
.then(success => console.log(`Bootstrap success`))
.catch(error => console.log('Filler' + error));
AOT配置
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"declaration": false,
"lib": [ "es2015", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"../appAot/node_modules/@types/"
],
"outDir": "../buildJs/"
},
"files": [
"appModule.ts",
"app.Routing.ts",
"boot.ts",
...
"services/searchService.ts",
"services/titleService.ts",
"services/uiService.ts",
"services/validationServices.ts"
],
"exclude": [ "node_modules" ],
"angularCompilerOptions": {
"genDir": "../appAot",
"skipMetadataEmit": true
}
我使用的是Angular2 4.3.5,Angular2-cli 4.3.5和Angular2-compiler 4.3.5 编译结果在appAot文件夹中生成。该文件夹包含所有ngFactories。 示例:searchComponent.ngfactory.ts以及searchComponent.ngsummary.json AOT编译会生成以下错误: C出错:.... \ searchComponent.ngfactory.ts:20:22无法找到模块' ./ SearchComponent' 在第20行的SearchComponent.ngFactory.ts中,可以找到以下内容: 从' ./ searchComponent';
导入*为i11每个导入语句都会出现此错误。
我错过了什么? 任何帮助都会非常感激