From 2f863a6f43f11e865d616f5d59827eaffc2a04f0 Mon Sep 17 00:00:00 2001 From: Tien Do Date: Wed, 23 May 2018 09:05:19 +0700 Subject: [PATCH] docs: update advanced example --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1803f42c..13ed9967 100644 --- a/README.md +++ b/README.md @@ -73,8 +73,11 @@ This plugin should be used only on `production` builds without `style-loader` in Here is an example to have both HMR in `development` and your styles extracted in a file for `production` builds. -(Loaders options left out for clarity, adapt accordingly to your needs.) +Please note that there is an open issue with Webpack's `mode` configuration ([#7074](https://github.com/webpack/webpack/issues/7074)), you need to set NODE_ENV in the command line instead of relying on the `mode` argument of `webpack-cli`. + +e.g. `NODE_ENV=production webpack` and not `webpack --mode=production` +(Loaders options left out for clarity, adapt accordingly to your needs.) **webpack.config.js** @@ -83,6 +86,7 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const devMode = process.env.NODE_ENV !== 'production' module.exports = { + mode: process.env.NODE_ENV, plugins: [ new MiniCssExtractPlugin({ // Options similar to the same options in webpackOptions.output