Skip to content

feat!: ESM-only conversion#2368

Merged
andrii-bodnar merged 50 commits intolingui:nextfrom
timofei-iatsenko:esm
Jan 26, 2026
Merged

feat!: ESM-only conversion#2368
andrii-bodnar merged 50 commits intolingui:nextfrom
timofei-iatsenko:esm

Conversation

@timofei-iatsenko
Copy link
Collaborator

@timofei-iatsenko timofei-iatsenko commented Nov 20, 2025

Description

#2363

Most noticable changes:

  1. Packages migrated to ESM-only, except @lingui/babel-plugin-lingui-macro, @lingui/loader, @lingui/macro (deprecated). Those excluded packages still using ESM depdendecies, so it will affect theirs consumers. Those packages was not converted to esm because there is no sense in that, babel and webpack consume them using a require function.
  2. Jest replaced to Vitest. I wasn't able to make Jest working with ESM modules without hacks. Vitest just worked out of the box with no issue
  3. Every package now has it's own tsconfig and build pipeline, since packages has diffrent targets (one for nodejs without a bundler, other for a bundler)
  4. The monorepo layout changed from using typescript path aliases to consume built artifacts. This is consequence of the point above. That ruined the whole dx inside of the monorepo, but this is temporarly step to make it work first, in next iterations i will try to improve development experience.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Examples update

Fixes # (issue)

Checklist

  • I have read the CONTRIBUTING and CODE_OF_CONDUCT docs
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)

@vercel
Copy link

vercel bot commented Nov 20, 2025

@timofei-iatsenko is attempting to deploy a commit to the Crowdin Team on Vercel.

A member of the Team first needs to authorize it.

@timofei-iatsenko
Copy link
Collaborator Author

@andrii-bodnar let's agree on the strategy for the new version for this.

As i mentioned this change is enough for version V6. However i'm going to prepare few more changes with restructuring which would be good to merge as a separate PR and stop this one growing.

  1. We can resurrect a next branch, merge PR into it. Wait for more upcoming PRs. Then release V6 from the next branch.
  2. We can merge that directly into main, wait for few more PRs and release V6 directly from the main.

In any case it's better to merge and release whatever non-breaking opened pull request we have and than put a code freeze on main branch until v6 would be released.

@andrii-bodnar
Copy link
Contributor

@timofei-iatsenko let's use the same workflow with the next branch. This will allow us to prepare everything (blog post, pre-releases, etc.) without blocking us from any stable release in the meantime.

I just pushed a fresh next branch created from the latest main

@timofei-iatsenko timofei-iatsenko changed the base branch from main to next January 15, 2026 16:22
@timofei-iatsenko
Copy link
Collaborator Author

@andrii-bodnar could you sync next branch once again? Also isn't this workflow helpful https://github.com/lingui/js-lingui/actions/workflows/next-sync.yml

@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 80.26316% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.23%. Comparing base (dd43fb0) to head (9f396c9).
⚠️ Report is 281 commits behind head on next.

Files with missing lines Patch % Lines
packages/cli/src/lingui-extract.ts 46.15% 7 Missing ⚠️
packages/cli/src/workers/compileWorker.ts 0.00% 3 Missing and 1 partial ⚠️
...-experimental/workers/extractWorkerWrapper.prod.ts 0.00% 2 Missing and 1 partial ⚠️
...kages/cli/src/workers/compileWorkerWrapper.prod.ts 0.00% 2 Missing and 1 partial ⚠️
...kages/cli/src/workers/extractWorkerWrapper.prod.ts 0.00% 2 Missing and 1 partial ⚠️
.../src/extract-experimental/workers/extractWorker.ts 0.00% 2 Missing ⚠️
packages/cli/src/workers/extractWorker.ts 0.00% 2 Missing ⚠️
...ackages/babel-plugin-extract-messages/src/index.ts 90.90% 1 Missing ⚠️
packages/cli/api.ts 0.00% 0 Missing and 1 partial ⚠️
packages/cli/src/api/extractWorkerPool.ts 90.90% 1 Missing ⚠️
... and 3 more
Additional details and impacted files
@@             Coverage Diff             @@
##             next    #2368       +/-   ##
===========================================
+ Coverage   76.66%   87.23%   +10.56%     
===========================================
  Files          81      123       +42     
  Lines        2083     7254     +5171     
  Branches      532     1494      +962     
===========================================
+ Hits         1597     6328     +4731     
- Misses        375      907      +532     
+ Partials      111       19       -92     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@andrii-bodnar
Copy link
Contributor

@timofei-iatsenko yes, this workflow has been explicitly disabled, I will enable it

# Conflicts:
#	babel.config.js
#	jest.config.js
#	packages/cli/package.json
#	packages/cli/src/lingui-extract.ts
#	packages/cli/src/services/translationIO.ts
#	packages/extractor-vue/package.json
#	packages/loader/package.json
#	packages/message-utils/package.json
#	packages/message-utils/src/generateMessageId.test.ts
#	packages/metro-transformer/package.json
#	packages/react/tsconfig.json
#	yarn.lock
@timofei-iatsenko
Copy link
Collaborator Author

This one is ready to be merged, - still not ready for release - i will fixup in separate PRs

@timofei-iatsenko timofei-iatsenko marked this pull request as ready for review January 24, 2026 11:09
@timofei-iatsenko
Copy link
Collaborator Author

I merged recent changes from main, but target for pr is next, that's why it shows unrelated changes. It should be good once next would be synced with main.

"packageManager": "yarn@3.4.1"
"packageManager": "yarn@3.4.1",
"resolutions": {
"threads@^1.7.0": "patch:threads@npm%3A1.7.0#./.yarn/patches/threads-npm-1.7.0-c432dbb3e9.patch"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've done a great job, thank you very much!

Have you considered switching to a different threading library instead of patching the current dependency? Perhaps it's worth creating a separate issue for this. I briefly looked at tinypool, for example, which is used in the vitest library: https://github.com/tinylibs/tinypool

Copy link
Collaborator Author

@timofei-iatsenko timofei-iatsenko Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, i considered. I tried priscina - but feel it very low level and API is quite diverged from the threads used. This patching would not work when the library would be consumed by the users, so i defenetily should tackle that.

This patch here is a temporal fix to mitigate issue and unblock further migration to ESM.

I will defentely take a look at tinypool as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UPD, i just recalled to myself what was patched here, and it's type only, so it most likely should not affect end users, until they would use cli api directly without skipLibCheck: true. However, the threads library looks unmaintained, and if you @yslpn want to experiment and change the implementation to tinypool i wouldn't resist. Only one request from me - make it after esm would be merged to avoid conflicts and try to keep the same level of the typesafety between workers implementation / and invocation.

@timofei-iatsenko
Copy link
Collaborator Author

timofei-iatsenko commented Jan 26, 2026

I merged recent changes from main, but target for pr is next, that's why it shows unrelated changes. It should be good once next would be synced with main.

I messed up the git. The same commits after merge in next and main essentially a different entities, so my branch is not showing correct diff right now and the whole history is messed up.

@andrii-bodnar could you drop the next branch entirely and recreate if from scratch. so there is no merge commits on it.

@andrii-bodnar
Copy link
Contributor

@timofei-iatsenko done

@timofei-iatsenko
Copy link
Collaborator Author

timofei-iatsenko commented Jan 26, 2026

@andrii-bodnar thanks, now it's good to be merged. Once it merged it should be code-freeze on the main branch.

@vercel
Copy link

vercel bot commented Jan 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
js-lingui Ready Ready Preview Jan 26, 2026 2:37pm

Request Review

Co-authored-by: Andrii Bodnar <andrii.bodnar@crowdin.com>
@andrii-bodnar andrii-bodnar merged commit d2a8e96 into lingui:next Jan 26, 2026
8 of 9 checks passed
@timofei-iatsenko timofei-iatsenko deleted the esm branch January 27, 2026 08:31
@andrii-bodnar andrii-bodnar added this to the v6 milestone Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants