kirillzyusko / react-native-bundle-splitter

HOC for lazy components loading

Home Page:https://kirillzyusko.github.io/react-native-bundle-splitter/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is a must-have

nidheeshdas opened this issue · comments

Is your feature request related to a problem? Please describe.
No. This project looks like a must-have for every RN app. But then why is this not so popular.

Describe the solution you'd like
Are there any articles on WHY this must be used, HOW much improvement in performance, WHAT are the gotchas if present?

Describe alternatives you've considered
I must implement and test this on my app.

Additional context
None. This is not really a feature request, but more of a request for guidance and any experiences of this this library.

Hi @nidheeshdas
Thank you for issue.
I think I wrote quite detailed documentation for this library.

This documentation contains step by step guide how to set up this library in any project. Also it has few tutorials such as "how to integrate this library with your navigation library"/"how to find the biggest dependency"/"how to measure startup time".

If you think I missed something important there - please, write below what you would like to see in the documentation.

How do experimentalImportSupport and inlineRequires relate to this project?

@kuasha420 this library is built on top of inlineRequires and ram bundles. Via register HOC you can easily move all screens/components to RAM bundle and load them on demand. (Couldn't find any info about experimentalportSupport. I would be highly appreciate you if you can give me a link where I can read about it).
Did I answer on your question?

@kirillzyusko Thanks for the quick answer! experimentalportSupport has no documentation actually. But was added at the same time as inlinerequire. Not sure what it does.

By the way, is it a good idea to try this on a react-native-web app or try spitting in webpack way?

Cheers!

@kuasha420 Unfortunately I don't know a lot of details about react-native-web. If you are saying, that webpack is used in react-native-web under hood, then I highly doubt that you can use this library out-of-box.

I know you can use react-loadable for splitting bundle on web projects. And I think you can use this library with react-native-web as well.

In fact I was thinking of adding web support into this library. It was on the roadmap and I thought to make a 2.0.0 release with web support. The API of both libraries is quite similar to each other so it shouldn't be a problem.

But if you go ahead and know the way how to bring a web support into this library - PRs are highly appreciated.

Thanks for the detailed answer. I'll investigate the matter and try to come up with something in the coming days. Cheers

@kuasha420 if you're interested in bundle splitting on web, it would be a great idea to consider Next.js which splits code out of the box.

You can easily make a mobile and web app with expo, combined with next.js. I have RAM bundles enabled for the mobile apps, and Next does its bundle splitting on web.

@heysailor That's a good idea for a new project. I'm trying to do it in an existing codebase. I've done some experimenting with loadable-component and it's working pretty well. Just need to adopt the idea with this project for a potential PR. Problem is require vs dynamic import

@kuasha420 if you want to add dynamic import support to react-native app you can use babel plugin. But I'm not sure that files imported via dynamic import construction will be moved into RAM bundle (I guess it should be, but it needs to be checked).

Also, feel free to create a new issue. Because the stuff that we discuss here is not related to the title of the issue😅

@kuasha420 and @heysailor I created new issue: #10

And I will close this one. Feel free to share new info there.