The title says it all. These settings are under Build & Deploy --> Post processing --> Asset optimization.
When “Bundle JS” is enabled, then “Minify JS” correctly controls whether the bundled js gets minified. But when “Bundle JS” is disabled, the individual JS files are never minified, even when “Minify JS” is enabled.
I was able to reproduce this on a minimal site with a simple html file referencing a simple js file. The site is https://quirky-lamarr-ddbf60.netlify.app/. The code is at https://github.com/russelldavis/netlify-demo.
Here is the full build log: https://gist.github.com/russelldavis/f5649cdd0bb947b9d288febb57c4c90c. It’s a bit suspicious that it says “Minifying js bundle” even though the “Bundle JS” setting is disabled. Here’s a screenshot of the settings:
Thanks for looking into this.
Thanks for the report!
We’re unlikely to make any changes to that functionality, so you should probably self-minify if you want custom behavior different than what we do. Our processing is not very sophisticated, so most of the existing solutions that are node modules (e.g. https://www.npmjs.com/search?q=keywords%3Aminify%2Cjs) should do as good or a better job for you
@fool thanks for the reply. Just to make sure we’re on the same page: you understand there’s a checkbox that says it does X, but it does not actually have any effect at all, and Netlify does not think that’s worth fixing? (A simple patch would be to just disable the checkbox in that situation.) I’m kind of shocked, wondering if there’s a misunderstanding.
Yup, I understand that it is not working as you expect. Without a better reproduction case (“here’s a site with only two files, that don’t minify as you can see in deploy https://asdf…”) I won’t be able to get a bug filed, so that’s why I suggested the easier solution for you
If you’d like to help me get a reproduction site setup, I’d be happy to file a bug for us. It won’t get fixed soon, since as I mentioned we aren’t working on that area of the app - so I was giving you advice you could use today rather than a bug report that buys you nothing in the short term, but happy to do it the other way (as well) if you’d like to help
@fool thanks, yes please file a bug. If you take a look at the original post, there is already a minimal reproduction case with only two tiny files exactly as you described.
(Sorry, I was out of the office last week!) Thanks much for that repro case, I have gotten the bug filed for us. We’ll follow up here if the team gets it fixed!