From b6c2145db05597f59b9691fed6a6afe3a7b48b59 Mon Sep 17 00:00:00 2001 From: Andy Wermke Date: Thu, 13 Oct 2016 09:25:15 +0200 Subject: [PATCH] Update main readme: Explain `env()` --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 0c994c18..87b2f364 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,22 @@ module.exports = createConfig([ ]) ``` +### env() + +You might wonder how `env('development', [ ... ])` works? Simple. It just checks the NODE_ENV environment variable and only applies its contained webpack blocks if it matches. + +So make sure you set the NODE_ENV accordingly: + +```js +// your package.json +"scripts": { + "build": "NODE_ENV=production webpack --config webpack.config.js", + "start": "NODE_ENV=development webpack-dev-server --config webpack.config.js" +} +``` + +If there is no NODE_ENV set then it will just treat NODE_ENV as if it was `development`. + ## Available webpack blocks