-
Notifications
You must be signed in to change notification settings - Fork 226
Description
With what library do you have an issue?
native-federation
Reproduction of the bug/regression with instructions
In a new Angular18+ project that has "type": "module" in its package.json, native federation can not be initialized because it uses require() and hardcoded 'federation.config.js' file name for initialization. Exception is thrown, asking to rename .js file to .cjs.
I changed hardcoded file name in libs/native-federation/src/builders/build/builder.ts from 'federation.config.js' to 'federation.config.cjs' and worked like a charm. I can push a PR to check for .cjs first and then for .js, if needed (or even have an optional filename parameter for config file)
Here is a Stackblitz example that throws this exception:
https://stackblitz.com/edit/stackblitz-starters-1ggp6r
Expected behavior
Expected to load with no error. If an Angular lib/app can not be initialized as ESM module due to native federation then what?
We can not change our app's nature, to commonjs just for this, it leads to a chain of changes that make this unusable.
Versions of Native/Module Federation, Angular, Node, Browser, and operating system
"@angular-architects/native-federation": "18.2.2"
Angular CLI: 18.2.10
Node: 20.13.1
OS: linux x64
Browser: Chrome 130.0.6723.70 (Official Build) (64-bit)
Other information
No response
I would be willing to submit a PR to fix this issue
- Yes
- No