diff --git a/webpack.config.js b/webpack.config.js index 6e7bc06..b4cc57c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,9 +1,10 @@ const webpack = require("webpack"); const UglifyJsPlugin = require('uglifyjs-webpack-plugin') var plugins = []; +const production = process.env.NODE_ENV === 'production'; //do we minify it all -if(process.env.NODE_ENV === 'production'){ +if (production) { console.log("creating production build"); plugins.push(new webpack.DefinePlugin({ 'process.env.NODE_ENV': 'production', @@ -43,7 +44,7 @@ module.exports = root: '_' } }, - plugins:plugins, + plugins: plugins, module: { rules: [ { @@ -60,8 +61,8 @@ module.exports = resolve: { extensions: [".tsx", ".ts", ".js"] }, - devtool: 'cheap-module-source-map', - mode: process.env.NODE_ENV || 'development', + devtool: production ? 'source-map' : 'cheap-module-source-map', + mode: production ? 'production' : 'development', optimization: { minimizer: [ // we specify a custom UglifyJsPlugin here to get source maps in production