Warning (node:11836) [MODULE_TYPELESS_PACKAGE_JSON] when using @module-federation/rsbuild-plugin
Describe the bug
Clone the linked repo.
npm i
Then run
npm run build -w mf-remote-rsbuild
This will yield:
(node:43128) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///C:/Users/me/git/stackblitz-starters-h6gf2a5j/node_modules/@module-federation/rsbuild-plugin/dist/index.esm.js is not specified and it doesn't parse as CommonJS. Reparsing as ES module because module syntax was detected. This incurs a performance overhead. To eliminate this warning, add "type": "module" to C:\Users\me\git\stackblitz-starters-h6gf2a5j\node_modules@module-federation\rsbuild-plugin\package.json.
Reproduction
https://github.com/vincesp/stackblitz-starters-h6gf2a5j
Used Package Manager
npm
System Info
System:
OS: Windows 10 10.0.19045
CPU: (16) x64 Intel(R) Xeon(R) W-11955M CPU @ 2.60GHz
Memory: 8.41 GB / 31.73 GB
Binaries:
Node: 22.9.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 10.3.0 - C:\Program Files\nodejs\npm.CMD
pnpm: 9.15.4 - ~\AppData\Roaming\npm\pnpm.CMD
Browsers:
Edge: Chromium (130.0.2849.68)
Validations
- [x] Read the docs.
- [x] Read the common issues list.
- [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [x] Make sure this is a Module federation issue and not a framework-specific issue.
- [x] The provided reproduction is a minimal reproducible example of the bug.
the package is supposed to be typeless, will see if anything can be done about it - its a limitation of the package build system that makes emitting the right file extensions hard
Stale issue message
Not stale
add this "type": "module" in your package.json
add this
"type": "module" in your package.json
It is deliberately typeless.
Stale issue message
What do you mean by "typeless"? If not specified, the default is "commonjs", see https://nodejs.org/api/packages.html#type
Specify commonjs will cause other issues in esm. Specify esm will cause other issue in cjs. Leaving it typeless mean it depends how you import it which will determine the type it resolves to. Bundler will use cjs and lose good tree shake if I set commonjs.
People file issues if I set it as cjs. People file issues if I set it as module. Nobody file issue when its typeless.
I guess this very issue is a specimen of the ones that are being filed when it is typeless?
You're the first :P
Stale issue message
Are there any news?