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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
When used in a Webpack Module Federation setup, this package cause a warning. #1697
Comments
just a warning, so we'll keep it like that for now |
Well it鈥檚 only a warning but in my case it prints 24 times everytime I update my code using HMR 馃槄 I was wondering what鈥檚 the reason for this nested package.json file? |
The reason is so it works for cjs and esm. |
Ok, thank you 馃檹馃徎 I figured this part out but I was wondering what is the reason for needing this nested package.json file to support cjs and esm because this is the first time I see it done that way. For example, the React Aria Components package can achieve cjs and esm support without any nested package.json file. The only thing they do is specifying both module systems fields in the root package.json file: "main": "dist/main.js",
"module": "dist/module.js",
"types": "dist/types.d.ts",
"source": "src/index.ts",
"exports": {
"types": "./dist/types.d.ts",
"import": "./dist/import.mjs",
"require": "./dist/main.js"
}, |
fyi: this was one of the reasons, why we need that: #1589 |
I see thank you 馃檹馃徎 I guess it works for React Aria component because they went for the |
@ScriptedAlchemy there's more info in this issue about the MFE warning we've been talking about on Twitter (the warning because there's a nested |
Adding |
馃悰 Bug Report
When this package is installed + imported in a Webpack Module Federation setup, it cause a warning:
The issue seems to be with nested
package.json
file. In my case withnode_modules/react-i18next/dist/es/package.json
.If I locally add the react dependencies to the
node_modules/react-i18next/dist/es/package.json
file, the warning goes away:To Reproduce
Here's a repository with a reproduction: https://github.com/patricklafrance/i18next-mfe-issue
Expected behavior
No warning when
react-i18next
is used in a Module Federation setup.Your Environment
Node v21.1.0
"i18next": "23.7.6"
and"react-i18next": "13.5.0"
Windows 10 Enterprise
The text was updated successfully, but these errors were encountered: