Given Page-Previews uses a pre-compilation step, there are clear benefits to using node based uglifyJS regarding size of bundle set to the client and source maps generation (see Compressed JS comparison)
In order to serve smaller payloads to users and improve the debugging experience in production
We need to use uglifyjs when running npm run build and ensure source-maps are served in production
AC
- npm run build builds assets with -p and a configured uglifyJS
- ResourceLoader doesn't re-minify ("filter" in RL parlance) the already minified asset (T160061#3234260)
- see @nomin at the top of the file
- Source maps are served in production and you can see and debug original sources in devtools
- Using debug=true sourcemaps still work with minified code
- We have documentation on wiki with size comparisons pre and post change
- We have documentation in an ADR about the change and decision