我正在处理webpack-config
,我想把我的sass文件导出为i.cc文件到“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
答案 0 :(得分:-1)