-
Notifications
You must be signed in to change notification settings - Fork 642
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
Update terser to v5, support async minifiers #606
Conversation
@@ -50,11 +50,7 @@ function minify({ | |||
/* $FlowFixMe(>=0.111.0 site=react_native_fb) This comment suppresses an | |||
* error found when Flow v0.111 was deployed. To see the error, delete this | |||
* comment and run Flow. */ | |||
const result = terser.minify(code, options); | |||
|
|||
if (result.error) { |
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.
Terser will now throw an error so there is no need for additional handling anymore.
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.
Thank you 👍
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.
@cpojer has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
We have a big integration with Metro and Buck internally that relies on this code being sync and changing every Flow to be async is a ton of work I unfortunately won't be able to get to. The good news is that with Hermes we shouldn't need a minifier, so we may be able to clean up our internal integration soon. |
I see, so you are using the metro-minify-terser package directly? What about landing the changes in metro-transform-worker only so it supports async minifiers? This would make it easy then to just publish a terser-v5 minify plugin. |
No, we don't actually use terser but we use the API synchronously in |
Ah ok, the function in transform-worker is already async, but I guess it works since there are no await in it currently. Alright in this case let's just keep this open and we can revisit later when the internal infra changes. |
Is there any hope to merging this? Our app is using terser and we've ran into a couple of terser bugs that it impossible to minify our app |
Summary: **Summary** Update terser to the latest version that supports more modern js syntax like optional chaining. The main breaking change in v5 is that minify is now async. To support this I also needed to add async minifier support in metro-transform-worker. **Test plan** - Run tests - Test building my app bundle with minifier terser and untransformed optional chaining Pull Request resolved: facebook#606 Reviewed By: feedthejim Differential Revision: D24883529 Pulled By: rh389 fbshipit-source-id: c9ed893535337ecc1ce16e433e3d689c2037be0a
Summary: **Summary** Update terser to the latest version that supports more modern js syntax like optional chaining. The main breaking change in v5 is that minify is now async. To support this I also needed to add async minifier support in metro-transform-worker. **Test plan** - Run tests - Test building my app bundle with minifier terser and untransformed optional chaining Pull Request resolved: facebook#606 Reviewed By: feedthejim Differential Revision: D24883529 Pulled By: rh389 fbshipit-source-id: c9ed893535337ecc1ce16e433e3d689c2037be0a
Summary: **Summary** Update terser to the latest version that supports more modern js syntax like optional chaining. The main breaking change in v5 is that minify is now async. To support this I also needed to add async minifier support in metro-transform-worker. **Test plan** - Run tests - Test building my app bundle with minifier terser and untransformed optional chaining Pull Request resolved: facebook#606 Reviewed By: feedthejim Differential Revision: D24883529 Pulled By: rh389 fbshipit-source-id: c9ed893535337ecc1ce16e433e3d689c2037be0a
Summary
Update terser to the latest version that supports more modern js syntax like optional chaining. The main breaking change in v5 is that minify is now async. To support this I also needed to add async minifier support in metro-transform-worker.
Test plan