You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -83,7 +84,7 @@ A better option is to extract the CSS into a separate file. Using the `emitCss`
83
84
{
84
85
test:/\.css$/,
85
86
use: [
86
-
dev?'style-loader':MiniCssExtractPlugin.loader,
87
+
prod?MiniCssExtractPlugin.loader:'style-loader',
87
88
{
88
89
loader:'css-loader',
89
90
options: {
@@ -103,7 +104,9 @@ A better option is to extract the CSS into a separate file. Using the `emitCss`
103
104
...
104
105
```
105
106
106
-
Note that the configuration shown above switches off `MiniCssExtractPlugin` in development mode in favour of using CSS javascript injection. This is recommended by `MiniCssExtractPlugin` because it does not support hot reloading. `dev` is some boolean flag indicating that the build is development.
107
+
Note that the configuration shown above switches off `MiniCssExtractPlugin` in development mode in favour of using CSS javascript injection. This is recommended by `MiniCssExtractPlugin` because it does not support hot reloading.
108
+
109
+
`prod` indicates, that `NODE_ENV=production` has been set from `package.json` or manually (`NODE_ENV=production npx webpack`) for production builds. We can rely on that to make dynamic adjustments to the config.
107
110
108
111
Additionally, if you're using multiple entrypoints, you may wish to change `new MiniCssExtractPlugin('styles.css')` for `new MiniCssExtractPlugin('[name].css')` to generate one CSS file per entrypoint.
0 commit comments