Skip to content

fix(deps): lift the lingui cap by deduping @lingui/react in the admin bundle - #1918

Merged
nasyrov merged 1 commit into
mainfrom
deps/babel-unify
Aug 24, 2026
Merged

nasyrov merged 1 commit into
mainfrom
deps/babel-unify

Conversation

@nasyrov

@nasyrov nasyrov commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Lifts the >=6.4.0 <6.5.0 lingui cap that #1915 added, and closes out the second
follow-up from that PR.

The stated plan doesn't work

The follow-up was "collapse the workspace onto one Babel major." That isn't
available. Three third-party packages take Babel 7 as a hard dependencies
entry
capped at ^7:

Package Declares
@tanstack/router-plugin @babel/core ^7.28.5, @babel/types ^7.28.5
babel-dead-code-elimination (via @tanstack/router-utils) @babel/core ^7.23.7
eslint-plugin-react-hooks @babel/core ^7.24.4

Meanwhile admin's rolldown/vite pipeline supplies @babel/core ^8.0.1, and
@rolldown/plugin-babel / @lingui/vite-plugin accept ^7.29 || ^8. Forcing
everything to 8 hands the three above a major they don't support; forcing 7 breaks
admin's build pipeline. Both majors coexist by necessity, so pnpm keeps
materializing one @lingui/react per peer context.

What actually fixes it

Two copies on disk is fine. Two copies in one bundle is not, because each
carries its own LinguiContext — which is why useLingui() returned null and the
editor rendered "Couldn't open the editor".

resolve.dedupe in admin's Vite config is the right lever, and pins the bundle to
a single copy. That's the whole change beyond the version bump.

I tried a scoped pnpm.overrides on the macro's peers first
(@lingui/babel-plugin-lingui-macro>@babel/types). It does nothing — the peer
instance keys come from what each consumer provides down the graph, not from the
macro's own declaration. Not shipped.

Verification

All 182 e2e tests pass across every suite that could see this — admin (129),
admin-editor (33), and the six plugins (20) — run individually. The pages suite is
the one that originally caught the regression.

Plus typecheck, lint, format, test:unit, i18n, and knip (cold).

Note on the remaining duplication

The lockfile still carries two @lingui/react entries, and the whole Babel
toolchain is still duplicated at 7.x and 8.x. That is upstream's shape, not
something this repo can resolve today. It becomes fixable when
@tanstack/router-plugin and eslint-plugin-react-hooks move to Babel 8 — at
which point the dedupe entry can go.

… bundle

#1915 capped lingui at <6.5 because 6.6 made the editor unopenable: `useLingui()`
read a null context, so the route loader threw and the screen rendered
"Couldn't open the editor".

The intended fix was to collapse the workspace onto one Babel major, which turns
out not to be available. Three third-party packages take Babel 7 as a hard
`dependencies` entry capped at ^7 — `@tanstack/router-plugin`,
`babel-dead-code-elimination` (via `@tanstack/router-utils`), and
`eslint-plugin-react-hooks` — while admin's rolldown/vite pipeline supplies
`@babel/core@^8.0.1`. Neither side can move, so both majors coexist and pnpm keeps
materializing one `@lingui/react` per peer context.

Two copies on disk is fine; two copies in one bundle is not, because each carries
its own LinguiContext. Vite's `resolve.dedupe` is the right lever and pins the
admin bundle to a single copy, which is what the failure was actually about. A
scoped `pnpm.overrides` on the macro's peers was tried first and does nothing —
the instance keys come from what each consumer provides, not from the macro's own
declaration.

Verified by the suites that caught the regression: all 182 e2e tests pass across
admin, admin-editor and the six plugins.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
plumix-marketing e29fa86 Commit Preview URL

Branch Preview URL
Aug 24 2026, 05:38 PM

@nasyrov
nasyrov merged commit 9df4b59 into main Aug 24, 2026
25 checks passed
@nasyrov
nasyrov deleted the deps/babel-unify branch August 24, 2026 18:02
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.

1 participant