ci: set NODE_ENV, fix out of memory issue, fix hot reload bundling

* ci: test docs-publish

* Specify to use prod

* Babel should transpile with env set by webpack

* chore: production defaults to true; set in --env.production by cli

* Remove lingering merge issue

* Add minimification plugins

* Need relative URLs to find root assets

* Default public url to forward slash in define plugin

* Don't wrap w/ react-hot-loader if we're building for production

* No need to log extensions

* Minimize using terser; and minimize css

* Import redux from es; this bypasses commonjs as import and fixes our "production build" warning

* Split commone webpack build for now to test hotfix

* postfix slash

* undefined safe env access

* Try to fix node_env prod issue w/ redux

* Set NODE_ENV production for all prod builds

* Syntax error

* nix tests

* Increase max amount of available memory

* Don't run bundle analyzer by default
This commit is contained in:
Danny Brown authored and GitHub committed 2019-08-29 08:53:33 -04:00
1 parent d26035fa55
commit d86f758125
15 files changed
+191 -36

No files matched your search

+6 -2
View File
@@ -1,10 +1,13 @@
const path = require('path');
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
// const ExtractCssChunks = require('extract-css-chunks-webpack-plugin');
module.exports = (env, argv, { SRC_DIR, DIST_DIR }) => {
const mode =
process.env.NODE_ENV === 'production' ? 'production' : 'development';
return {
mode,
entry: {
bundle: `${SRC_DIR}/index.js`,
},
@@ -22,6 +25,7 @@ module.exports = (env, argv, { SRC_DIR, DIST_DIR }) => {
// Find babel.config.js in monorepo root
// https://babeljs.io/docs/en/options#rootmode
rootMode: 'upward',
envName: mode,
presets: [
[
'@babel/preset-env',
@@ -115,7 +119,7 @@ module.exports = (env, argv, { SRC_DIR, DIST_DIR }) => {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.DEBUG': JSON.stringify(process.env.DEBUG),
'process.env.APP_CONFIG': JSON.stringify(process.env.APP_CONFIG || ''),
'process.env.PUBLIC_URL': JSON.stringify(process.env.PUBLIC_URL || ''),
'process.env.PUBLIC_URL': JSON.stringify(process.env.PUBLIC_URL || '/'),
}),
],
// Fix: https://github.com/webpack-contrib/css-loader/issues/447#issuecomment-285598881