-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uglify terser copy #256
Uglify terser copy #256
Conversation
…l instances of `uglify(-es)?` replaced with `terser`.
…erser` a (modified) copy of `-uglify`; (2) remove the `noSourceMap` function (and associated tests &c.); (3) move Flow types from minifier to core `metro` package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Thanks a lot!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rafeca has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Hey! How to use it? |
I would like to know too.. |
Hey! For RN 57 this
also |
@DimitryDushkin thanks for response ! btw in RN 0.59.1 there is new |
Hey @haggholm I'm trying to use this now and I get this error: The reason I am trying it is due to this issue: #645 And using inbuilt terser support instead of using a custom config seemed like a better idea
My metro config:
|
@radiosilence did you figure out a workaround for this? |
If you're seeing |
Thanks, I suppose installing a newer version of metro doesn't work as it's tied to the react-native version (my package.json has metro, metro-minify-terser and metro-react-native-babel-preset at 0.70.1). |
Yes - manually adding
If you're using Yarn you could (via React Native 0.68 will give you Metro 0.67 which includes the latest minifier-related updates, so updating to that is another option. Otherwise, you'll need to downgrade (This confusion should be sorted out soon-ish - I'm waiting for terser to cut a new release after terser/terser#1164, then we'll make |
Summary
Add support for using terser.
terser
is a fork ofuglify-es
, which is not really maintained; and maintains API compatibility withuglify-es
.In order to avoid duplicating configuration like default options in
metro-minify-uglify
, this PR adds a parameter tometro-minify-uglify
that allows passing in an alternative minifier module, and the new packagemetro-minify-terser
calls this, passing interser
.This is based on discussion in #230.
After earlier submitting #243, I created this alternative PR to address comments from @rafeca
Test plan
The tests are simply copied from
metro-minify-uglify
, since the API is and the results should be identical.