-
-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Description
Is this a bug report?
No
Proposal:
Support a new environment variable TERSER_CONFIG. A dev could set it to a JSON with config values supported by Terser and CRA would merge default this JSON with its default Terser config.
Example:
- Set
TERSER_CONFIGto{ "keep_classnames": true } keep_classnamesset totrueadded to Terser options
Reasoning:
Certain libraries rely on class names which are minified by default by Terser. It would be nice to change that without maintaining a fork of CRA for one line of code only.
I'm pretty sure there're other cases as well. Anyway it's pretty simple to add this, it would give developers more freedom, so what's the harm, right? :)
Implementation considerations:
If TERSER_CONFIG environment variable is present, do JSON.parse of its value and add it to Terser options here. Add TERSER_CONFIG to this list.
Would you be willing to accept a PR for this functionality?