Open vrady opened 1 month ago
@vrady I can confirm that the target is hard-coded and that NF should use the value from the tsconfig.json.
Would it be possible for you to contribute a PR for this change?
@rainerhahnekamp hi, I've opened PR https://github.com/angular-architects/module-federation-plugin/pull/674. Could you check it please?
With what library do you have an issue?
native-federation
Reproduction of the bug/regression with instructions
Hello, we’ve recently started using Native Federation to build a Micro Frontend (MFE) application. Everything works fine on modern browsers, but we discovered that the code fails at runtime on iOS Safari versions earlier than 16.4 due to the use of newer ES features. In our case, the issue stemmed from the @angular/platform-browser library, which utilizes static initialization blocks which was landed in ES2022.
In our tsconfig and browserslist files, we target ES2015 and iOS > 14, but the generated code only works on iOS > 16.4 due to the issues mentioned earlier. I discovered that the library builds shared libs with a configuration where the ‘esnext’ target is hardcoded, ignoring the target specified in the application. I patched that line to use a local constant (ES2015 in my case), and now the shared libraries are generated in the ES2015 format.
Is it correct that Native Federation generates shared libraries in the ‘esnext’ format and ignores the target specified in the application? Is there an alternative solution to generate the shared libraries with the correct target version, or should we wait for a fix in a future release?
Thanks in advance for your help.
Expected behavior
The Native Federation builder should use the target specified in tsconfig or browserslist to generate the shared libraries files.
Versions of Native/Module Federation, Angular, Node, Browser, and operating system
Native Federation: 18.2.2 Angular: 18.2.8 Node: 20.16.0 Browser: iOS Safari 16.0 OS: iOS