-
in web projects, we can generate chunks based on route, in react-native projects, we use I read the /** * `getInitializationEntries` will return necessary entries with setup and initialization code. * If you don't want to use Hot Module Replacement, set `hmr` option to `false`. By default, * HMR will be enabled in development mode. */
entry: [
...ReactNative.getInitializationEntries(reactNativePath, {
hmr: devServer.hmr,
}),
entry,
], |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
The easiest way is to do it in code. I'm not sure what do you mean generate chunks based on route exactly but if you're using // MyScreen.js
function MyScreen() {
// ...
}
// somewhere
const MyScreen = React.lazy(() => import('./MyScreen.js'));
<Stack.Navigator>
<Stack.Screen name="MY_SCREEN" component={MyScreen} />
</Stack.Navigator> |
Beta Was this translation helpful? Give feedback.
-
What about just use webpack's code splitting way https://webpack.js.org/guides/code-splitting/#entry-points |
Beta Was this translation helpful? Give feedback.
The easiest way is to do it in code. I'm not sure what do you mean generate chunks based on route exactly but if you're using
react-navigation
you should be able to do something like this: