作者:手机用户2502898397 | 来源:互联网 | 2023-09-17 17:03
1、怎么在webpack里配置sass,我要把处理完的xx.scss文件提取成文件
2、代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| var webpack = require("webpack");
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var ExtractTextPlugin2 = require('extract-text-webpack-plugin');
module.exports = {
entry: "./src/js/entry.js",
output: {
path: __dirname,
filename: "./build/bundle.js"
},
module: {
loaders: [
{
test: /.js$/,
loader: "babel-loader",
exclude: /node_modules/
},
{
test: /.scss$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader!sass-loader"),//这里如果没用ExtractTextPlugin是没问题的,用了提取不出来
exclude: /node_modules/
}
]
},
plugins: [
new ExtractTextPlugin('[name].css')
]
}; |