Skip to content

Shared libraries generated with esnext target #673

@vrady

Description

@vrady

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.

image

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.

image

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions