我试图让SASS编译我的阵营+的WebPack项目运行,并继续运行到这个错误:提取文本插件“加载器没有相应的插件” - 反应,萨斯的WebPack
Module build failed: Error: "extract-text-webpack-plugin" loader is used without the corresponding plugin
其次从本教程指南:Link
这里是我的webpack.config.js
有什么建议?
const debug = process.env.NODE_ENV !== "production";
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
context: path.join(__dirname, "src"),
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/client.js",
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015', 'stage-0'],
plugins: ['react-html-attrs', 'transform-class-properties', 'transform-decorators-legacy'],
}
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('css!sass')
}
]
},
output: {
path: __dirname + "/src/",
filename: "client.min.js"
},
plugins: debug ? [] : [
new ExtractTextPlugin('dist/styles/main.css', {
allChunks: true
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }),
],
};
@Micahel Jungo - 这已修复它,但是,我的sass没有编译到main.css表单中? – Filth
没有'ExtractTextPlugin'它不会创建一个css文件,但它在你的JS包中。所以如果你仍然希望它被提取出来,你也需要在开发中使用这个插件。 –
对不起队友我有点困惑...似乎这是围绕调试状态。删除它会更好吗?我不确定我的webpack.config文件应该如何运行,并将sass编译为单个.css工作表? – Filth