lingui / js-lingui

🌍 📖 A readable, automated, and optimized (3 kb) internationalization for JavaScript
https://lingui.dev
MIT License
4.64k stars 383 forks source link

Modernizing the codebase #2042

Closed timofei-iatsenko closed 1 month ago

timofei-iatsenko commented 1 month ago

I will use this issue as an Epic for ongoing work for modernizing Lingui codebase.

The goals of this Epic are:

  1. Migrate to ES Modules
  2. Migrate to Vite from Jest
  3. Update libraries which update was blocked by es modules.
  4. Setup dependabot

Migrate to ES Modules

This is a challenging task because we are supporting babel macro plugin which is not supporting ES modules yet, and this blocks all used in this plugin dependencies to be migrated to ESM. (CJS modules could be imported from ESM modules, but ESM modules could not be imported from CJS synchronously). I started working on ground changes in the babel to support ESM in the babel-plugin-macros

This would be a major update with a breaking changes, because everyone who uses lingui internals from CJS context will not be able to do so after switching to ESM.

While we would be waiting for broader adoption of these changes in the babel & babel-plugin macros, I'm going to use jiti to provide CJS shim for ESM macro.

Subtasks:

Migrate to Vite from Jest

Vite starts up much faster, needs less setup, and works well with ESM right away. While Jest has been popular for a long time, its many users make it hard to change things fundamentally without breaking existing setups. This has slowed down progress and made it tough to improve quickly.