-
Notifications
You must be signed in to change notification settings - Fork 241
Description
With what library do you have an issue?
native-federation
Reproduction of the bug/regression with instructions
- Create a Native Federation remote/shell.
- Add a shared/exposed dependency whose entrypoint is published as
index.mjs(e.g.some-lib/dist/icons). - Run
npm install. - Run the NF build (e.g.
npx nx build <remote>).
-> Esbuild aborts withCould not resolve "<package>/dist/icons".
Expected behavior
Esbuild should resolve .mjs entrypoints of shared/exposed packages without manual patching; the build should succeed.
Versions of Native/Module Federation, Angular, Node, Browser, and operating system
- @angular-architects/native-federation: 20.1.7
- Angular: 20.3.x
- Node: v24.10.0 (also reproducible on Node 20)
- OS: macOS (Apple Silicon)
- Browser: Chrome (n/a for build issue)
Other information
Link to PR resolving the issue: #993
Link for ESBuild docs for resolveExtensions property: https://esbuild.github.io/api/#resolve-extensions
From ESBuild docs:
The resolution algorithm used by node supports implicit file extensions. You can require('./file') and it will check for
./file,./file.js,./file.json, and./file.nodein that order. Modern bundlers including esbuild extend this concept to other file types as well. The full order of implicit file extensions in esbuild can be customized using the resolve extensions setting, which defaults to.tsx,.ts,.jsx,.js,.css,.json.
Note that esbuild deliberately does not include the new.mjsand.cjsextensions in this list. Node's resolution algorithm doesn't treat these as implicit file extensions, so esbuild doesn't either. If you want to import files with these extensions you should either explicitly add the extensions in your import paths or change this setting to include the additional extensions that you want to be implicit.
I would be willing to submit a PR to fix this issue
- Yes
- No