Created by: jpdriver
Escape hatch that excludes webpack's UglifyJsPlugin
if MINIFY_JS=false
is set in the .env
file in the project root.
Not minifying production builds was a specific client request (despite my strong recommendations!)
So I need to use this (and am doing so in a fork) -- but figured I'd open a PR in case anyone else finds this useful...
Thanks!
Changes
- refactored the
plugins
array outside of the rest of the production webpack config to allow for programmatic configuration - included new
shouldMinifyJs
bool that reads fromprocess.env.MINIFY_JS
- push
UglifyJsPlugin
to the plugins array as normal, unlessshouldMinifyJs
is false
Test Steps undertaken
-
npm run create-react-app react-app
from root to create a new project cd react-app
yarn build
- open
build/static/js/main.js
echo 'MINIFY_JS=false' >> .env
yarn build
- open
build/static/js/main.js