3 回答
TA贡献1808条经验 获得超4个赞
可以通过
plugins: [
new CommonsChunkPlugin({
name: '[id].js',
chunks: chunks,
minChunks: 1
})
]
类似设置实现,
普通js文件:
module.exports = {
entry: {
bundle1: './addr.js',
bundle2: './backward.js'
.......
},
output: {
filename: '[name].js'
}
};
TA贡献1786条经验 获得超11个赞
webpack配置:
const ExtractTextPlugin = require('extract-text-webpack-plugin')
module.exports = {
output: {
path: path.join(__dirname, './dist'),
filename: 'js/[name].js',
publicPath: '/dist/'
},
module: {
loaders: [
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style',
loader: 'css',
publicPath: '../'
})
},
]
},
plugins: [
new ExtractTextPlugin({
filename: 'css/[name].css',
disable: false,
allChunks: false
})
]
}
- 3 回答
- 0 关注
- 652 浏览
添加回答
举报