【发布时间】:2017-04-05 14:40:59
【问题描述】:
我尝试这样的组件相关模板 URL
dialog.component.ts
@Component({
moduleId: module.id,
selector: 'modal-confirm',
templateUrl: 'dialog.component.html',
styleUrls: ['dialog.component.css']
})
tsconfig.json
"compilerOptions": {
"target": "es5",
"module": "commonjs",
....
},
systemjs.config.js
typescriptOptions: {
emitDecoratorMetadata: true,
experimentalDecorators: true,
module: "commonjs",
},
使用 JiT,我得到了
Error: (SystemJS) module is not defined
ReferenceError: module is not defined at eval (http://localhost:3000/app/shared/services/dialog.component.ts!transpiled:104:35)
点击链接进入这一行
moduleId: module.id,
我错过了什么?
更新 实际上,我收到的错误比上面提到的要多。在许多情况下,AoT 需要更严格的代码才能通过类型检查器。它比我预期的要复杂得多。在 JiT 模式下有效的东西可能在 AoT 模式下无效。我会再等 3-6 个月,看看 AoT 编译器如何改进。
【问题讨论】:
-
你是用dist文件夹还是什么???
-
是的,我正在使用 dist 文件夹。这对相对路径错误有影响吗?
标签: angular typescript angular2-template