From 60ec67c2a9550684d78df67f23ee7a650cbae529 Mon Sep 17 00:00:00 2001 From: Andrey Okonetchnikov Date: Thu, 6 Oct 2016 15:59:19 +0200 Subject: [PATCH] Added `process.env.NODE_ENV` to webpack.DefinePlugin --- webpack.base.js | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/webpack.base.js b/webpack.base.js index 80a24194..2052d935 100644 --- a/webpack.base.js +++ b/webpack.base.js @@ -1,3 +1,5 @@ +/* eslint global-require: 0 */ + const webpack = require('webpack'); module.exports = { @@ -5,11 +7,11 @@ module.exports = { loaders: [ { test: /\.((png)|(eot)|(woff)|(woff2)|(ttf)|(svg)|(gif))(\?v=\d+\.\d+\.\d+)?$/, - loader: 'url-loader?limit=100000' + loader: 'url-loader?limit=100000', }, { test: /\.json$/, - loader: 'json-loader' + loader: 'json-loader', }, { test: /\.scss$/, @@ -31,15 +33,21 @@ module.exports = { 'transform-object-assign', 'transform-object-rest-spread', 'lodash', - 'react-hot-loader/babel' - ] - } - } - ] + 'react-hot-loader/babel', + ], + }, + }, + ], }, - postcss: [ require('postcss-import')({ addDependencyTo: webpack }), - require('postcss-cssnext') + require('postcss-cssnext'), + ], + plugins: [ + new webpack.DefinePlugin({ + 'process.env': { + NODE_ENV: JSON.stringify(process.env.NODE_ENV), + }, + }), ], };