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

More clear documentation on Dynamic Imports #1081

Open
rubenspgcavalcante opened this issue Sep 12, 2023 · 0 comments
Open

More clear documentation on Dynamic Imports #1081

rubenspgcavalcante opened this issue Sep 12, 2023 · 0 comments

Comments

@rubenspgcavalcante
Copy link

Currently, I'm exchanging some lazy loaded routes, that uses functions wrapping "require" in favor of dynamic imports in combination of React.lazy and Suspense.

The problem is, although in development I see in the docs Metro will indeed lazy evaluate the lazy loaded modules, isn't clear that this will actually happen on production too:

"import() calls are supported out of the box. In React Native, using import() automatically splits your application code so that it loads faster during development, without affecting release builds."

from https://facebook.github.io/metro/docs/module-api/#import-dynamic-import

So, it will not affect release builds because is retro compatible to require, or because instead of lazy loading it will statically load for production (in contrast to development)? The docs seems not much clear about it :/

I just need to ensure that the whole app will not be loaded at once on startup and change the current behaviour I'm achieving by using () => require() functions on my navigations.

Thanks in advance! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant