-
-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the "disabled" option #88
Comments
webpack.config.js const env = process.env.NODE_ENV || 'development'
const config = {
mode: env,
...
plugins: [
this.mode === 'production' ? new MiniCSSPlugin() : false
].filter(Boolean)
} That's the 'generic' way to do it within |
The problem is you would have to add the same conditional logic to the loader which gets messy especially if you support multiple CSS formats (CSS, LESS...). Otherwise, webpack throws the following error: Module build failed: TypeError: this[NS] is not a function |
It seems that webpack.config.js const css = (env = 'development', extend = []) => [
env === 'production' ? MiniCSS.loader : 'style-loader',
'css-loader',
].concat(extend)
const config = {
module: {
...
use: css(this.mode, [ 'some-loader' ])
...
}
} |
ExtractTextPlugin has a disabled option that can be used to easily disable it during hot reload or watch builds. It would be a nice enhancement to the MiniCssExtractPlugin as well.
The text was updated successfully, but these errors were encountered: