2

I'm trying to implement Code Splitting in a React Native app. Currently I managed to load multiple bundles in Android both in packager mode and in production mode.

However, on iOS I'm facing the following issue: Cannot initialize hmrClient twice. I'm trying to load the additional bundles using [bridge.batchedBridge executeSourceCode] which works in production mode but throws when using the packager.

When looking at the implementation of executeSourceCode I see that it indeed calls setupHMRClientWithBundleURL without checking if it was already initialized.

Is there any way to overcome this issue?

1 Answer 1

0

So it seems that metro does things a bit differently in dev vs prod and I didn't account for that.

Bundling JS with --dev true works. In order to avoid the hmrClient error it's better to use [bridge.batchedBridge executeApplicationScript] rather than executeSourceCode.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.