Limenius / ReactBundle

Client and Server-side React.js rendering in a Symfony Bundle
MIT License
390 stars 53 forks source link

Code Splitting / Lazy loading #49

Open dbrxnds opened 4 years ago

dbrxnds commented 4 years ago

Currently there is no documentation or way to code split (as far as I could find) using the ReactBundle setup as shown in the tutorial.

I have tried using React Lazy as well as regular JS dynamic imports including different Webpack settings in both cases but the end result remains a single verisoned app.js file.

My theory is that the ReactOnRails.register() function combines all components thus defeating the purpose of code splitting.

Could anyone point me in the right direction on how to approach this issue?

maps82 commented 4 years ago

I don't think it will work without patching ReactOnRails and/or this bundle, as the current render path doesn't seem to support async functions. But I would also like to get this implemented.