我在将angularJs应用程序升级到Webpack4时遇到了问题。
这是我的设计:
vendor.ts
import "angular";
import "angular-i18n/de-de";
import "angular-route";和
main.ts
import {MyAppModule} from "./my-app.app";
angular.element(document).ready(() => {
angular.bootstrap(document.body, [MyAppModule.name], { strictDi: true });
});和webpack在一起,我有一个commonsChunkPlugin,一切都很顺利。
对于webpack 4,我使用splitChunks选项5次不导入angularjs:
webpack.config.ts
...
optimization: {
splitChunks: {
cacheGroups: {
commons: {
name: "commons",
chunks: "initial",
minChunks: 2
}
}
}
}
...这是正确的工作。我只在我的common.js文件中加载了angularjs代码。但不幸的是,代码被实例化了两次,所以应用程序总是记录警告:
警告:尝试多次加载AngularJS。
块是通过html中的HtmlWebpackPlugin加载的。
知道怎么删除警告吗?
发布于 2018-03-14 09:04:34
https://stackoverflow.com/questions/49272493
复制相似问题