-
Notifications
You must be signed in to change notification settings - Fork 259
Description
With what library do you have an issue?
native-federation
Reproduction of the bug/regression with instructions
I attached a minimal Nx repro. Steps:
- npm install
- npm run build:esbuild → succeeds
- npm run build:nf → fails
Failure:
Two output files share the same path but have different contents: media/duplicate.svg
The repo has a tiny shared library (dup-lib) in sharedMappings. Its styles reference two different SVG files with the same basename.
Expected behavior
Native Federation should not collapse distinct media files to the same emitted path. It should honor Angular’s media hashing behavior, or otherwise emit unique media filenames, so the build succeeds.
Versions of Native/Module Federation, Angular, Node, Browser, and operating system
Native Federation: 21.2.1
Angular: 21.1.5
Nx: 22.5.4
Node: v22.19.0
npm: 11.6.2
Browser: N/A (build-time failure, no browser needed)
OS: macOS 26.3.1 arm64
Other information
Plain Angular build passes; only the Native Federation build fails.
Possible cause: Native Federation’s esbuild adapter appears to emit media as media/[name], ignoring Angular outputHashing:
"media".
Was able to overcome this locally by using patch-package,
diff --git a/node_modules/@angular-architects/native-federation/src/utils/angular-esbuild-adapter.js b/node_modules/@angular-architects/native-federation/src/utils/angular-esbuild-adapter.js
index df55a09..bcaa7c3 100644
--- a/node_modules/@angular-architects/native-federation/src/utils/angular-esbuild-adapter.js
+++ b/node_modules/@angular-architects/native-federation/src/utils/angular-esbuild-adapter.js
@@ -113,7 +113,7 @@ async function runEsbuild(builderOptions, context, entryPoints, external, outdir
: await getTailwindConfig(searchDirectories);
const outputNames = {
bundles: '[name]',
-
media: 'media/[name]',
-
};
media: 'media/[name]-[hash]',
let fileReplacements;
if (builderOptions.fileReplacements) {
Not sure if this is the correct way to solve it.
I would be willing to submit a PR to fix this issue
- Yes
- No