角度4 AOT与webpack

前端之家收集整理的这篇文章主要介绍了角度4 AOT与webpack前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_502_2@
我使用角度4与webpack 2&试图使用AOT,但它给我这个错误:10%构建模块4/5模块1活动…_ modules / intl / locale-data / jsonp / en.jsModuleNotFoundError:找不到模块:错误:无法解析’ ./../$$_gendir/src/app/app.module.ngfactory’in’/ Users / xyz / angular-upgrade / backend / myapp / angular / src’.

这是我的webpack.config:

new AotPlugin({
  tsConfigPath: './tsconfig.json',entryModule: './src/app/app.module#AppModule'
}),

我用来构建的脚本是:“build”:“rimraf dist&& webpack –config config / webpack.prod.js –progress –profile –bail”

下面是我的tsconfig.json:

{
  "compilerOptions": {
    "target": "es5","module": "commonjs","moduleResolution": "node","sourceMap": true,"emitDecoratorMetadata": true,"experimentalDecorators": true,"lib": ["es2015","dom"],"noImplicitAny": false,"suppressImplicitAnyIndexErrors": true
  },"exclude": [
    "node_modules","bower_components"
  ]
}

解决方法

AOT现在不支持高于2.0.10的打字稿版本.你需要确保这一点.此外,你必须将一些角度模块,如http,平台浏览器或核心更改回角度2 – 我使用版本2.4.0 –,因为版本2.0.10或更低版本的打字稿不支持它们!
@H_502_2@

猜你在找的Angularjs相关文章