Skip to content
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

fix: use fixed @loadable/babel-plugin #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brunos3d
Copy link
Owner

No description provided.

@ladasfeed
Copy link

ladasfeed commented Feb 2, 2023

Hello! I tried to run your example from that repository.
The problem:

  • Local component imported via loadable is not a separate chunk.
  • If i do not mount component imported via loadable ( remote or local ), component will be loaded anyway.

looks like ssr behaviour, but for client... i think babel-plugin does not use templates.standart from here https://github.com/gregberge/loadable-components/pull/938/files

If i turn off the flag for the client version, everything works fine except one thing.
If a component which is loaded from remote using loadable mounts immediately ( without any conditions ), i get an error on the client side:
loadable-components: failed to synchronously load component, which expected to be available.
On the other hand if such component mounts by condition ( which means it wont be mounted immediately after hydration ) - everything works fine! Chunk will be loaded and mounted with no errors when conditions are met.

Please let me know if you wanna get some more details/examples.

Thank you for your amazing work!!!

@brunos3d
Copy link
Owner Author

Hello, @ladasfeed.

Probably it's happening due to the "resolveWeak" imports used in loadable, I'm working on some stuff about it: an article, a repository with examples, and these adapters.

I will approach how to solve the most common errors in the article using @mf/loadable-adapters like in the sample-4 which I also had an error on sample-3 and an isolated example of the error here.

While the article is not finished I suggest you use the SsrSyncFederationLoader.loader on your webpack config for server-side (here an example), especially before babel-loader and injects the preload script tags on HTML before the entrypoint script using the FederatedChunkExtractor. during SSR like I did here. It will preload the modules so loadable will be able to load it from resolveWeak functions.

Hope this helps you, I will try to keep you posted from here, but keep an eye on https://valor-software.com/articles, it will be posted there soon 🚀

@brunos3d brunos3d added help wanted Extra attention is needed question Further information is requested labels Feb 11, 2023
@ladasfeed
Copy link

@brunos3d thank you so much for the detailed answer!
I will keep an eye on the blog 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants