-
-
Notifications
You must be signed in to change notification settings - Fork 235
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
the default import cannot be correctly resolve #2995
Comments
Hi @ScriptedAlchemy, any comments here? |
Okay the problem is indeed the default import. |
if i go i18next.default.on, it works in the library |
Thanks for your kindly reply @ScriptedAlchemy. Actually this issue is not only occurred on rspack but also on webpack. The problem is indeed default import. We tested many situation, and finally found that this problem happened when the following three conditions all met:
When we use i18next in our codebase under the above conditions: import i18next from 'i18next'
i18next.init() Then the bundler will resolve it incorrectly, treating Hope these information can help. |
Most likely this needs to be filed with the webpack core and rspack core projects. Does original federation in webpack also have the issue? I'll take a look in my source but it seems like a deeper problem to how modules are wrapped. I can make it look for .default but that will have other problem or basically reverse the issue to only default |
yeap, original federation in webpack also have the same issue. @ScriptedAlchemy |
I'd open an issue with webpack core. I'd also try it with rspack, which my team has direct control over. If it's a problem in rspack, I can get that patched if a GitHub issue is opened. As a workaround you can use a runtime plugin on loadShare / the resolver for it and you could automatically return the default export or re merge and modify the exports as you wish. |
@ScriptedAlchemy The bug is also open on rspack |
Perfect. Then we will need to wait for it to be fixed on the Rust end so that it aligns correctly with webpack. |
Describe the bug
Several factors combined together led to this problem.
Details
From the code, it can be seen that i18next in the bundled is a named import, but it is actually a default import, which leads to the inability to find the i18next.on method.
When I try to remove multiple entries or take i18next out of the shared score, this project works fine
Details
or
I provided a demo on codesandbox, which makes it easier to debug the project when downloaded locally
Reproduction
https://codesandbox.io/p/devbox/mf-bundle-demo-635f7l
Used Package Manager
pnpm
System Info
Validations
The text was updated successfully, but these errors were encountered: