Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !2947

dont include UglifyJsPlugin if MINIFY_JS is false

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/jpdriver/master into master Aug 12, 2017
  • Overview 3
  • Commits 1
  • Pipelines 0
  • Changes 1

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 from process.env.MINIFY_JS
  • push UglifyJsPlugin to the plugins array as normal, unless shouldMinifyJs is false

Test Steps undertaken

  1. npm run create-react-app react-app from root to create a new project
  2. cd react-app
  3. yarn build
  4. open build/static/js/main.js
screen shot 2017-08-12 at 16 41 45
  1. echo 'MINIFY_JS=false' >> .env
  2. yarn build
  3. open build/static/js/main.js
screen shot 2017-08-12 at 16 44 08
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/jpdriver/master