Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

janicduplessis
Copy link
Contributor

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.

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
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 6, 2020
@cpojer
Copy link
Contributor

cpojer commented Nov 11, 2020

We actually rely on this at FB as we access JSON files from native 🤔

@janicduplessis
Copy link
Contributor Author

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?

@cpojer
Copy link
Contributor

cpojer commented Nov 11, 2020

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.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a 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.

@facebook-github-bot
Copy link
Contributor

@cpojer merged this pull request in 279f04f.

dcalhoun added a commit to wordpress-mobile/gutenberg-mobile that referenced this pull request Dec 22, 2021
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
dcalhoun added a commit to wordpress-mobile/gutenberg-mobile that referenced this pull request Jan 24, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
3 participants