1 回答
TA贡献1803条经验 获得超6个赞
设置多个ExtractTextPlugin
比如
...
const ExtractTextPlugin1 = require("extract-text-webpack-plugin");
const ExtractTextPlugin2 = require("extract-text-webpack-plugin");
....
...
rules:[
{
test:/\.less$/,
include:[path.resolve(__dirname, "./less")],
use: ExtractTextPlugin1.extract({
fallback: "style-loader",
use: [ 'css-loader?minimize=true', 'less-loader' ]
})
},
{
test:/\.css$/,
include:[path.resolve(__dirname, "./css")],
use: ExtractTextPlugin2.extract({
fallback: "style-loader",
use: [ 'css-loader?minimize=true']
})
},
]
...
plugins: [
...
new ExtractTextPlugin1('1.css'),
new ExtractTextPlugin2('2.css')
]
这样less文件打包就到1.css,普通css文件打包就到2.css,js里的css也同理。只需要把include文件位置设置好,对应的path打包进对应的ExtractTextPlugin就OK
添加回答
举报