当先锋百科网

首页 1 2 3 4 5 6 7

webpack2的写法

需要用到的插件

const ExtractTextPlugin = require('extract-text-webpack-plugin');


{
test:/\.css$/,
exclude:node_modules,

use:ExtractTextPlugin.extract({fallback:"style-loader",use:["css-loader"]}),

//use:ExtractTextPlugin.extract({fallback:"style-loader",use:["css-loader","postcss-loader"]})

},


plugins:[
new ExtractTextPlugin("[name].css"),

]
注:webpack1的写法ExtractTextPlugin.extract("style-loader","css-loader"); webpack2不支持