【问题标题】:Can't build Angular 5 with AOT systemjs无法使用 AOT systemjs 构建 Angular 5
【发布时间】:2017-11-29 13:06:34
【问题描述】:

我一直在寻找解决我的问题的方法,但没有成功。所以也许有人可以帮助我。

我正在从 ng 4.4.4 升级到 5.0.1,在 JIT 模式下一切似乎都可以正常工作,但是当我尝试编译到 AOT 模式时它不起作用。

错误表明模块 app.module.ngfactory 找不到,这似乎是有道理的,因为它由于某种原因没有生成。

这些是我的文件:

main-aot.ts

import { platformBrowser } from '@angular/platform-browser';
import { enableProdMode } from '@angular/core';
import { AppModuleNgFactory } from '../Scripts/dist/aot/tsScripts/app.module.ngfactory';

enableProdMode();
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);

tsconfig-aot.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "es2015",
      "dom"
    ],
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "outDir": "Scripts/dist/aot",
    "typeRoots": [
      "node_modules/@types/"
    ]
  },
  "files": [
    "tsScripts/app.module.ts",
    "tsScripts/main-aot.ts"
  ],
  "angularCompilerOptions": {
    "genDir": "Scripts/dist/aot",
    "skipMetadataEmit": true,
    "preserveWhitespaces": false
  }
}

我用来编译的命令是:

ngc -p tsconfig-aot.json && rollup -c rollup-config.js

谁能帮帮我?

提前致谢

【问题讨论】:

    标签: angular


    【解决方案1】:

    最后,我将我的项目结构转移到使用 angular-cli 并且一切都恢复正常了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-09
      • 2018-06-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-22
      相关资源
      最近更新 更多