我的项目基于Angular2-webpack-starter。目前与Angular2 rc.4
和在一起webpack 1.13.1
。如果我在开发人员模式下运行它,则一切正常。
但是,如果在生产模式下运行,Failed to load app/app.component.html
由于会出现异常GET http://localhost:8080/app/app.component.html 404 (Not Found)
。
我检查了webpack.common.js,webpack.dev.js和webpack.prod.js文件。产品配置没有什么特别的,并且html加载器实际上在共享webpack.common.js
文件中。我正在寻求有关如何调试此问题的帮助。
angular2-webpack-starter使用angular2-template-loader
来跟踪html和样式依赖性,据我所知,最终templateUrl:
将组件中的template:
属性更改为properties并实际上内嵌了HTML文件。因此,您的应用甚至不应该调用html文件。您是否更改了通用配置文件以删除angular2-template-loader
?在通用配置(https://github.com/AngularClass/angular2-webpack-starter/blob/master/config/webpack.common.js)中的第143行。
还要确保将tsconfig.json正确设置为超棒的加载器,angular2-template-loader
需要将该useWebpackText
属性设置为true。参见此处(在要求下):https : //github.com/TheLarkInn/angular2-template-loader
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句