3

为了支持 i18n,必须支持 AOT,因此需要在我的 components 和 set中使用 relativetemplateUrl和。styleUrlsmoduleId: module.id

这非常适合我的开发版本,它不使用 systemjs 捆绑和加载文件(使用 gulp 构建)

  1. 编译打字稿:`目标:es5,模块:commonjs'

在生产版本中,我使用 rollup.js 进行摇树和捆绑。在这里我必须进行编译步骤,因为汇总需要 es2015 模块,而浏览器(并在组件中设置 module.id)需要 common.js

  1. 编译打字稿:target: es5, module: es2015
  2. 与 rollup.js 捆绑:format: iife
  3. 再次编译打字稿:target: es5, module: commonjs, allowJs: true

这样做我在运行应用程序时收到以下错误:未能加载 app.component.html

版本信息:

  • 角度:2.2.1
  • 打字稿:2.0.10
  • 汇总:0.36.3

有谁知道是什么导致了这个问题?非常感谢你的帮助

4

0 回答 0