Open dmarcos opened 4 years ago
The replacement of uglify is terser https://github.com/terser/terser I use it myself for my own aframe build like this:
npm run dist:max
npm i terser
npx terser --compress -- dist/aframe-master.js >dist/aframe-master.min.js
Thanks. What about source maps?
It creates one, I have the dist/aframe-master.min.js.map
file that is modified.
Thanks @vincentfretin, I had the issue last week and found a poor workaround using a specific version of uglify-es. I tried terser today with AFrame 1.0.1 and it works perfectly :)
Has anyone terser working on A-Frame repo? Willing to share a PR? Thank you 🙇
Here it is #4588
I tried various combinations of commands and options and I didn't manage to have a browserify build with terser and a correct sourcemap. From the documentation, this is supposed to work:
npm run dist:max
npx terser --source-map "content='dist/aframe-master.js.map'" -m --output dist/aframe-master.min.js dist/aframe-master.js
to generate the sourcemap taking into account the input sourcemap non minified aframe-master.js.map, but this doesn't work.
Ok. Thanks for the investigation.
I didn't remember I worked on that already in December 2019 and created another issue #5106 with the PR #5111 to fix it. At that time I didn't know much about the -c and -m options of terser I guess.
@dmarcos you can close this issue.
Error when minifying DracoLoader source. It looks it's the only part of THREE js shipping ES6
uglify-js failed on node_modules/super-three/examples/js/loaders/DRACOLoader.js : SyntaxError: Unexpected token: operator (>)
Build still generates but DracoLoader code is not minimized.