-
Notifications
You must be signed in to change notification settings - Fork 638
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
Add back support for the assetPlugin option #118
Conversation
Metro used to have support for "asset plugins", which allowed developers to specify arbitrary JS modules that could export a function for adding more fields to asset data objects. Some of this functionality was removed in the delta bundler work -- this PR adds it back. Test Plan: Made existing unit tests pass and added unit tests to test asset plugin behavior. Also tested E2E in a React Native project by adding `assetPlugin=/path/to/pluginModule` to a JS bundle URL and ensuring that the plugin ran.
create-react-native-app for RN 0.52 depends on this change, which is part of the motivation for this PR. |
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.
Thanks for adding this feature back to metro @ide !
I indeed removed it when refactoring the bundler
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 is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: **Summary** Metro used to have support for "asset plugins", which allowed developers to specify arbitrary JS modules that could export a function for adding more fields to asset data objects. Some of this functionality was removed in the delta bundler work -- this PR adds it back. **Test plan** Made existing unit tests pass and added unit tests to test asset plugin behavior. Also tested E2E in a React Native project by adding `assetPlugin=/path/to/pluginModule` to a JS bundle URL and ensuring that the plugin ran. Closes #118 Differential Revision: D6711094 Pulled By: rafeca fbshipit-source-id: f42c54cfd11bac5103194f85083084eef25fa3cd
Thanks for the review and updating the Jest config in RN too! Would it be possible to publish 0.24.4 to npm so that installing RN 0.52 (which depends on ^0.24.1) will get this update? |
@ide I've just published v0.24.4 to npm, let me know if there is any issue |
Summary
Metro used to have support for "asset plugins", which allowed developers to specify arbitrary JS modules that could export a function for adding more fields to asset data objects. Some of this functionality was removed in the delta bundler work -- this PR adds it back.
Test plan
Made existing unit tests pass and added unit tests to test asset plugin behavior. Also tested E2E in a React Native project by adding
assetPlugin=/path/to/pluginModule
to a JS bundle URL and ensuring that the plugin ran.