我有webpack生成以下捆绑文件:
问题是我希望延迟加载的模块(例如:0.chunk.prod.js)成为main.prod.js包的一部分。
module.exports = {
entry: {
'polyfills': './staticContent/polyfills.ts',
'main': ["./path/to/main.ts" ]
},
resolve: {
extensions: ['.ts', '.js'],
alias: { }
},
module: {
loaders: [
{
test: /\.html$/,
use: 'html-loader?minimize=false',
},
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: "vendors",
minChunks: function (module) {
return module.context && module.context.indexOf("node_modules")!== -1;
}
})
]
};
module.exports = webpackMerge(commonConfig, {
output: {
path: __dirname + '/bundles',
filename: '[name].prod.js',
chunkFilename: '[id].chunk.prod.js'
},
module: {
loaders: [
{ test: /\.ts$/, loaders: ['@ngtools/webpack'] }
]
},
plugins: [
new AotPlugin({
tsConfigPath: './tsconfig.aot.json',
entryModule: 'path/to/app.module#AppModule'
}),
new ExtractTextPlugin({
filename: "[name].prod.css"
}),
new webpack.optimize.UglifyJsPlugin({
minimize: true,
compress: {
warnings: false
},
output: {
comments: false
},
sourceMap: false
}
)
]
});