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
pluginsarray outside of the rest of the production webpack config to allow for programmatic configuration - included new
shouldMinifyJsbool that reads fromprocess.env.MINIFY_JS - push
UglifyJsPluginto the plugins array as normal, unlessshouldMinifyJsis false
Test Steps undertaken
-
npm run create-react-app react-appfrom root to create a new project cd react-appyarn build- open
build/static/js/main.js
echo 'MINIFY_JS=false' >> .envyarn build- open
build/static/js/main.js