【发布时间】:2017-05-08 14:38:47
【问题描述】:
我的错误如下:
[at-loader] assets\app\app.module.ngfactory.ts:28:27 中的错误 找不到模块“./app.component.ngfactory”。
在我运行 npm run build 后,app.module.ngfactory.ts 已按预期创建,但它创建了对我没有/找不到的模块的引用:
import * as import21 from './app.component.ngfactory';
查看aot-complier 链接,我在编译应用程序部分看到以下内容:
好奇的可以打开aot/app.component.ngfactory.ts查看 中间的原始 Angular 模板语法, 编译成 TypeScript 的形式。
我认为我的问题可能来自于我在运行时
“node_modules/.bin/ngc”-p tsconfig-aot.json
它希望为它正在创建的组件分配一个名称,我不确定该名称是否可以是任何名称,或者它是否需要特定的名称。 我尝试了 NgFactory、app.component.ngfactory 和我的项目名称,但这些都没有做出任何我可以看到的更改。我也没有看到在我的 tsconfig-aot.json 文件中指定为 genDir 的文件夹,只有 outDir。
ngc 完成后,在 aot 文件夹(在 tsconfig-aot.json 中指定为 genDir 的文件夹)。
以下是我的 tsconfig-aot.json 当前包含的内容:
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"outDir": "./public/js/app"
},
"exclude": [
"node_modules",
"dist",
"assets/app/polyfills.ts"
],
"angularCompilerOptions": {
"skipMetadataEmit" : true
}
}
如果您需要任何其他信息,请告诉我。我还没有找到任何关于这个的东西,我已经找了两天了。
【问题讨论】:
标签: angularjs node.js angular2-aot