Skip to content

[Compiler Bug]: babel-plugin-react-compiler bundles an outdated @babel/core and semver #38392

Backlog

Description

@taxor03

What kind of issue is this?

  • React Compiler core (the JS output is incorrect, or your app works incorrectly after optimization)
  • babel-plugin-react-compiler (build issue installing or using the Babel plugin)
  • eslint-plugin-react-hooks (build issue installing or using the eslint plugin)
  • react-compiler-healthcheck (build issue installing or using the healthcheck script)

Link to repro

Not app-specific: static check of the published npm tarball (steps below).

Repro steps

[email protected] (current latest) ships dist/index.js, a tsup bundle that keeps only @babel/types external. It inlines a full @babel/core 7.2.0 (the copy behind the exported runBabelPluginReactCompiler helper) and its semver 5.7.1. Both come from the dev setup in compiler/packages/babel-plugin-react-compiler/package.json ("resolutions": { "@babel/core": "7.2.0" }), and compiler/yarn.lock on main still resolves semver@^5.4.1, semver@^5.6.0 to 5.7.1.

These versions are covered by two published advisories (list below), fixed in semver 5.7.2 and @babel/core 7.29.6. Neither is a dependency of the published package, so npm audit and SCA tools cannot see these copies, for you or for projects that install the plugin. (The open PR #37478 raises the declared @babel/core range of eslint-plugin-react-hooks for the same @babel/core advisory; it does not change this bundled copy.)

Suggested fix: bump the @babel/core resolution to 7.29.6 or later (which uses semver 6.3.1) and rebuild, or, if 7.2.0 is pinned on purpose, add @babel/core to external in tsup.config.ts so the plugin uses the project's own Babel.

Static reproduction (2026-11-25):

  1. npm pack [email protected] && tar xzf babel-plugin-react-compiler-1.0.0.tgz
  2. grep -A1 'name: "@babel/core",' package/dist/index.js | grep -c 'version: "7.2.0"' → 1
  3. grep -c 'node_modules/semver/semver.js' package/dist/index.js → 2 (one inlined semver module)
  4. grep -c 'safeRe' package/dist/index.js → 0 (added in semver 5.7.2)

How often does this bug happen?

Every time

What version of React are you using?

Not app-specific

What version of React Compiler are you using?

1.0.0

Advisories

semver 5.7.1:

@babel/core 7.2.0:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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