npm run build without any minification
See original GitHub issueIs this a bug report?
Not really.
Suggestion
I saw https://github.com/facebook/create-react-app/issues/3448 by @Xopsy and unfortunately this has been closed. However, I do have a legitimate use case for it.
So my suggestion is: Provide a way to e.g. pass --dev
or so to npm run build
, so I can get a build output in the same way as I get when running npm start
, i.e. unminified.
Background
I’ve fairly documented that background in https://stackoverflow.com/questions/55165466/how-to-build-a-production-version-of-react-without-minification (and this question) already, so I’ll make it short: In browser add-ons (WebExtensions) minification is nearly useless as it is saved offline and can even cause problems, as inline JavaScript is included.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to build a production version of React without minification?
npm run build built unobfuscated, readable code that ran as expected, using no other modifications. Used Gitbash only with the commands npm ...
Read more >react-scripts-plugin-no-minify - npm
Plugin to disable minification for Create React App. Latest version: 0.4.0, last published: 4 years ago. Start using ...
Read more >How to Not Minify Source with webpack - David Walsh Blog
I think the way is to create two separate files, one for dev and one for production building. Then attach them to package.json...
Read more >Tutorial: How to Minify & Version a JS File with NPM Scripts
Minify your script.js file as script.min.js; Add the new version number and build time to the header of your script.min.
Read more >npm run build does not minify bundles #9458 | Support Center
As you can see below, "npm run build" executes correctly with no errors, but the created bundles are identical to the dev versions...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Heh, you should have mentioned csp issues. This should solve your problem:
I’ve linked to it all over the place 😉
But, yes, awesome! That solves my use case totally!
So, @heyimalex, if you want, feel free to submit this as an answer to https://stackoverflow.com/questions/55160698/how-to-use-react-without-unsafe-inline-javascript-css-code.