Here is an example where style-loader
is being used as a fallback in development mode. But why is it used this way? You can find more details here.
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const extractSass = new ExtractTextPlugin({
filename: "[name].[contenthash].css",
disable: process.env.NODE_ENV === "development"
});
module.exports = {
...
module: {
rules: [{
test: /\.scss$/,
use: extractSass.extract({
use: [{
loader: "css-loader"
}, {
loader: "sass-loader"
}],
// In development, use style-loader as fallback
fallback: "style-loader"
})
}]
},
plugins: [
extractSass
]
};