2
我有动态导入模块与共同的依赖,我需要common.js与g.js(在这个例子中),但它不工作,我有空的共同点。 有什么不对? 我想g.js共同webpack 2懒加载
index.js
System.import("./d")
.then((module) => {
});
System.import("./t")
.then((module) => {
});
t.js
import "./g";
module.exports = {
x: 5
}
d.js
import "./g";
export function message() {
alert("msg")
}
webpack.config.js
module.exports = {
entry: {index: "./index.js"},
context: __dirname,
output: {
filename: "dist/[name].js"
},
resolve: {
modules: [
"bower_components",
path.resolve('./'),
],
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: `common`,
async: true
})
]
};