Interactive interface for browsing global, full-resolution satellite imagery
refactor webpack env variable logic and npm script to use cross-env and new ANALYZE_MODE and TESTING_MODE env variables
Ed Plato84e715f8fe45
diff --git a/package.json b/package.jsonindex f479ec7bf..250d91b1c 100644--- a/package.json+++ b/package.json@@ -26,10 +26,10 @@"node": "8.8.1"},"scripts": {- "analyze": "cross-env NODE_ENV=analyze webpack",+ "analyze": "cross-env ANALYZE_MODE=true NODE_ENV=production webpack","browserstack": "node e2e/browserstack.js -c e2e/browserstack.conf.js -e browserstack ","build": "run-s clean getcapabilities build:config build:dev",- "build:dev": "webpack",+ "build:dev": "cross-env NODE_ENV=development webpack","build:config": "bash -c 'tasks/buildOptions.sh' && node ./tasks/config.js","build:prod": "cross-env NODE_ENV=production webpack","clean": "node ./tasks/clean.js",diff --git a/webpack.config.js b/webpack.config.jsindex bb16202dc..bc321f427 100644--- a/webpack.config.js+++ b/webpack.config.js@@ -6,14 +6,13 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');const WriteFilePlugin = require('write-file-webpack-plugin');const CopyWebpackPlugin = require('copy-webpack-plugin');+// production optimizationsconst OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');const cssnano = require('cssnano');const UglifyJsPlugin = require('uglifyjs-webpack-plugin');-const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')- .BundleAnalyzerPlugin;-const devMode =- process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'testing';+// environment dev flag+const devMode = process.env.NODE_ENV !== 'production';const pluginSystem = [new CleanWebpackPlugin(['web/build']),@@ -32,15 +31,16 @@ const pluginSystem = [/* Conditional Plugin Management */// add hot module replacement-if (process.env.NODE_ENV === 'development') {+if (devMode) {pluginSystem.push(new webpack.HotModuleReplacementPlugin(), // use path to module for development performancenew webpack.NamedModulesPlugin());}-// add bundle analzyer-if (process.env.NODE_ENV === 'analyze') {+// conditionally required and add plugin bundle analzyer+if (process.env.ANALYZE_MODE === 'true') {+ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;pluginSystem.push(new BundleAnalyzerPlugin());}@@ -48,7 +48,7 @@ if (process.env.NODE_ENV === 'analyze') {let entryPoint = './web/js/main.js';let outputFileName = 'wv.js';/*-if (process.env.NODE_ENV === 'testing') {+if (process.env.TESTING_MODE === 'true') {entryPoint = './test/main.js';outputFileName = 'wv-test-bundle.js';}