webpack如何从指定的入口文件中提取css,
entry:{
'entry1':"./a.js",
'entry2':"./b.js",
'entry3':"./c.js",
'entry4':"./d.js"
}
比如我要将entry1和entry2中的css提取到style1.css, 3和4提取到style2.css
试过extract-text-webpack-plugin了么?这个应该就可以的哦
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry:{
'entry1': './a.js',
'entry2': './b.js',
'entry3': './c.js',
'entry4': './d.js'
},
module: {
loaders: [
{
test: /\.css$/, loader: ExtractTextPlugin.extract('css-loader')
}
]
},
plugins: [
new ExtractTextPlugin('[name].css')
]
}