我正在做一个webpack-config,我想把我的sass文件作为.css文件导出到"static/css",就像我对js所做的那样。我不能让它工作。我的webpack是这样的:
const path = require('path')
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const isProd = process.env.NODE_ENV === 'production'
const config = {
devtool: '#eval-source-map',
entry: './src/js/index.js',
output: {
filename: isProd ? '[name].[chunkhash].js' : '[name].js',
path: path.resolve(__dirname, 'static/js')
},
module: {
rules: [{
test: /\.js$/,
loader: 'buble-loader',
exclude: /node_modules/,
options: {
objectAssign: 'Object.assign'
}
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract(['css-loader', 'sass-
loader'])
}]
}
}
if (isProd) {
config.devtool = '#source-map'
config.plugins.push(
new webpack.LoaderOptionsPlugin({
minimize: true
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true
})
)
}
module.exports = config发布于 2018-03-12 22:13:27
https://stackoverflow.com/questions/49237017
复制相似问题