-
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
Remove JSON from default asset types #593
Conversation
JSON files are currently considered both source and assets so they are duplicated in the js bundle and in the assets copied in the final app. I think this is a better default and if someone relies on json files being also included in the bundle they can add it back in their metro config. Fixes facebook#487
We actually rely on this at FB as we access JSON files from native 🤔 |
Hmm so native looks for the file in assets and relies on RN to bundle it? Seems like quite the hack, but I don't see another easy way for native to access it without JS sending it though the bridge. Do you think it'd be possible to update the facebook metro config to add back JSON in asset types and remove it from the default OSS config? |
Yeah we may be able to do that, I can take a look. It may sound hacky but it allows us to do a ton of work in native to preload stuff instead of initializing a JS VM. |
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.
The static JSON file assets are not the sourced by the app. Instead, the data found within the JavaScript bundle itself is utilized. The unnecessary static JSON files should now no longer be exported when bundling the JavaScript thanks to a bug fix in React Native. - #4329 (comment) - facebook/metro#593
The static JSON file assets are not the sourced by the app. Instead, the data found within the JavaScript bundle itself is utilized. The unnecessary static JSON files should now no longer be exported when bundling the JavaScript thanks to a bug fix in React Native. - #4329 (comment) - facebook/metro#593
Summary
JSON files are currently considered both source and assets so they are duplicated in the js bundle and in the assets copied in the final app. I think this is a better default and if someone relies on json files being also included in the bundle they can add it back in their metro config.
Fixes #487
Test plan
Test that json files are no longer present in my app assets and the app still works.