Skip to content

V6 Roadmap: ESM Only distribution #2363

@timofei-iatsenko

Description

@timofei-iatsenko

The JavaScript ecosystem keeps moving forward, and more and more projects are switching to ESM-only distribution.

I’ve tried to make this change a few times already, but each time I was blocked by various incompatibilities. LinguiJS is a complex project consisting of multiple parts — runtime, CLI, and plugins for different tools.

Switching to ESM-only requires ensuring interoperability across all these tools. The main roadblock was usually supporting ESM in the babel-plugin-macros. I even contributed to Babel itself babel/babel#16860 to make this possible in the future.

However, the babel-plugin-macros codebase is quite outdated, and before working on the original issue, a lot of maintenance work was needed just to bring everything up to date. Because of that, I had to postpone this task for a long time.

Fortunately, the ecosystem has evolved, and with recent Node.js improvements — such as require(esm) backported to Node.js 20 — this workaround is no longer necessary. That means we can now distribute LinguiJS as pure ESM.

I expect no major changes will be required from users unless they rely on very specific or non-standard setups. Still, since this is a significant shift, it should be released as a new major version, similar to what Storybook 10 did.

I don’t plan to include any other major changes in this release — this breaking change will be big enough on its own.

Testing checklist:

  • Ensure support for webpack
  • Ensure support for babel-plugin-macros
  • Ensure support for metro

Bump minimal nodejs version requirement to 20.16+, 22.19+, or 24+

Blockers:

MartinCerny-awin/pseudolocale#27
andywer/threads.js#496

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions