-
Notifications
You must be signed in to change notification settings - Fork 42
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
Components not loading asynchronously. #28
Comments
Hi Ryan, Are you using webpack? My guess is that your You can configure this setting using the MinChunkSizePlugin. For example, I set this to a ridiculous |
@jennasalau, thank you. I have added the And having the |
Hi Ryan, Finally had a chance to look into this one. You have indeed found a bug as I can replicate it. It seems the way we have architected the registrations, the Promise body is evaluating immediately causing the chunks to load upfront. Currently we are supporting code separation which was tested, just not lazy loading :( The problem seems to be with the Habitat API at the very surface level.
The promise executor is evaluating immediately (or in our case resolving the module/chunk). We will probably have to wrap it in a function that returns a Promise so it only evaluates the executor when called. ie
Unfortunately this is going to be a breaking change dangit. |
I'm sad that it will be breaking, but very excited to see this working! It is essential for us. 😸 |
I have pre-released this fix as part of v1.0.0-beta (Since we have been sitting stable for a while lets put this as a v1 milestone). To test this fix please |
|
I guess it depends if you're building a JS library or an app :D Webpack will put React Habitat into the built binary so no need for the dependency after that. |
Oh, the README has just |
@jennasalau just implemented 1.0.0-beta in an existing project and adjusted my syntax. Works as expected 👍 |
Working here too: https://github.com/ryanpcmcquen/react-habitat-poc |
Is |
Yep it's appearing that way. Just need to test typescript and we can go prod. |
Tests complete, this is now published as 1.0.0 |
I probably have something configured incorrectly, but despite using
registerAsync
:My bundle files are the same size regardless of whether I have one component on the page or all of them.
Here's my manifest file: https://github.com/ryanpcmcquen/react-habitat-poc/blob/master/source/Manifest.js
Any ideas what I might have configured incorrectly? Or is this just how
registerAsync
works in this scenario?The text was updated successfully, but these errors were encountered: