Skip to content

fix(babel-plugin-lingui-macro): restore @babel/types as a runtime dependency - #2634

Open
andrii-bodnar wants to merge 1 commit into
mainfrom
fix/babel-types-runtime-dependency
Open

fix(babel-plugin-lingui-macro): restore @babel/types as a runtime dependency#2634
andrii-bodnar wants to merge 1 commit into
mainfrom
fix/babel-types-runtime-dependency

Conversation

@andrii-bodnar

Copy link
Copy Markdown
Contributor

@babel/types is imported as a runtime value in ~140 places across the plugin sources (t.identifier, t.stringLiteral, t.isStringLiteral, …) and survives into the build as import * as t from '@babel/types' in dist/shared/*.mjs.

#2623 moved it from dependencies to an optional peerDependency, so package managers neither install it nor warn. Resolution then only succeeded when @babel/types happened to be hoisted into the consumer tree; under strict or nested resolution it failed with ERR_MODULE_NOT_FOUND.

Move it back into dependencies and drop the redundant devDependency entry. @babel/core stays an optional peer since it is type-only at runtime, so Babel 8 support from #2623 is unaffected.

Fixes #2628

Description

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

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)

…ependency

`@babel/types` is imported as a runtime value in ~140 places across the
plugin sources (`t.identifier`, `t.stringLiteral`, `t.isStringLiteral`, …)
and survives into the build as `import * as t from '@babel/types'` in
`dist/shared/*.mjs`.

#2623 moved it from `dependencies` to an *optional* `peerDependency`,
so package managers neither install it nor warn. Resolution then only
succeeded when `@babel/types` happened to be hoisted into the consumer
tree; under strict or nested resolution it failed with
`ERR_MODULE_NOT_FOUND`.

Move it back into `dependencies` and drop the redundant devDependency
entry. `@babel/core` stays an optional peer since it is type-only at
runtime, so Babel 8 support from #2623 is unaffected.

Fixes #2628

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
js-lingui Ready Ready Preview Jul 30, 2026 1:47pm

Request Review

@github-actions

Copy link
Copy Markdown

size-limit report 📦

Path Size
packages/core/dist/index.mjs 1.69 KB (0%)
packages/detect-locale/dist/index.mjs 633 B (0%)
packages/react/dist/index.mjs 1.9 KB (0%)

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.

Cannot find package '@babel/types' when run messages:extract

1 participant