-
Notifications
You must be signed in to change notification settings - Fork 194
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
Code splitting & OTA #70
Comments
CC: @axemclion |
so currently haul does not support code splitting? my app had large bundle size (4MB) and it effects app load time. I thought that because haul is based on webpack and webpack supports code splitting that it will be possible to load only what's necessary when app loads and the rest afterwards |
Webpack needs the DOM to insert script tags when doing code splitting. Since we don't have DOM, it's not possible. Also, as an app user I'm already used to download large apps, probably lazy loading code will not improve the experience at all. |
@satya164 Why not use something similar to |
Yeah, I think eventually we want to do that. I was just saying that we probably cannot use webpack's code splitting feature as is right now. |
Is there a way to lazy load modules by using webpack dynamic |
Wait, even if webpack requires the DOM, that is just for the target: web, if you use target: node, webpack will use just require statements! Has anyone played with this yet? |
We use web workers target as closest to what plays nice with RN. While migrating to webpack 4 however, we feel like creating our own custom target to get rid of some nasty hacking |
Besides the importScripts and eval, is there a reason the generic node target wasn't sufficient. |
@TheLarkInn not that I know of. The only reason is the script loading mechanism. You can check the comments here #182 (comment) We haven't tried |
Here are the considirations I have when it comes to using
And most importantly it still has to work properly in webworker, since with attached debugger the JS bundle will be executed in worker context. |
Okay so after taking some time to read the Rather this works like just splitting out (for no particular rhyme or reason), the module graph into x bundles that access the same globally defined runtime on Turns out Here is an example of me using a contrived sample: This stiches the runtime with other loaded chunks using
This is exactly what webpack does with the webworker target! |
So if you all know how to take this output, and stiched together set of bundles, "unbundled", and do whatevers needed for RN to consume it the right way, then we would be golden. |
@TheLarkInn Great findings. |
These are separate files but just loaded sequentially? According to RN docs it says its bin encoded blobs or something? |
If the unbundle feature exists, which generates multiple files, then there must be some way to make the RN to load all of those files. So the questions would be:
|
@zamotany Did that |
@zamotany they basically wrote a webpack require runtime and a custom chunk wrapper why I'm not sure still but it looks just like webpack had generated about x small common chunks that are sync loaded. |
@krizzu no, it was there for months but undocumented. Delta bundles are another thing, which we should investigate because the concept is pretty neat. @TheLarkInn Ok, so the bundles are requested from JS side. Curious how they load it, since |
Hola, any update on this? |
1 similar comment
Hola, any update on this? |
@zamotany Hey, sorry for taking so long to get back on this. Okay, from what I understand, this is the equivalent of adding 8 scripts to your head and they all load. (With the unbundled one first). Basically each file executes sequentially and adds their modules on |
Due to the nature of React Native, code splitting can be achieved using:
|
How to separate js bundle into framework bundle and user code bundle?
and then ,When we publish a single file to user's cell phone ,We Just need combine a single file to the base bundle.
The text was updated successfully, but these errors were encountered: