Skip to content

[pages-components] Publish new release with React 19 support + tsup fix from PR #127 #130

@chrissnyder2337

Description

@chrissnyder2337

Description

Version 1.2.2 of @yext/pages-components introduces a regression that breaks compatibility with React 18 and React 19 in Next.js applications. The build fails with:

Module not found: Package path ./jsx-runtime.js is not exported from package react

Note: I see that PR #127 has already reverted these changes on main and switched to tsup, but no new version has been published to npm yet. The latest tag currently points to 1.1.18, which doesn't include React 19 peer dependency support. This issue is to track publishing a new release that includes both the React 19 peer dependency support AND the tsup fix.

Timeline of Changes

Version Date Change Status
1.2.0 Nov 11 Added React 19 peer dep support, dropped CommonJS Working
1.2.1 Nov 14 PR #124: Excluded react/jsx-runtime from build Working
1.2.2 Nov 19 PR #126: Added .js extension rewrite for Node 20+ Broken
main Dec 2 PR #127: Reverted to tsup build Fixed (unreleased)

Root Cause

PR #126 (commit c70062e) added a fixReactJsxRuntime Vite plugin that rewrites imports from react/jsx-runtime to react/jsx-runtime.js to support React 17 + Node 20+.

From the PR description:

React 17 does not declare jsx-runtime in its "exports" because it predates subpath exports. Under Node 20+'s stricter ESM rules, imports must include an extension instead of guessing extensions for bare subpath imports. We now rewrite the generated bundle to include the .js extension for react/jsx-runtime.

However, React 18/19 properly use the exports field in package.json, which only exports ./jsx-runtime (without .js):

"exports": {
  "./jsx-runtime": {
    "default": "./jsx-runtime.js"
  }
}

When the plugin rewrites to react/jsx-runtime.js, it bypasses the exports field and tries to access an unexported path, causing the build to fail.

Current npm State

  • latest: 1.1.18: (React 17/18 only - no React 19 peer dep support)
  • 1.2.1: (React 19 support - working)
  • 1.2.2: (React 19 support - broken)

Request

Please publish a new version (1.2.3 or 1.3.0) that includes:

  1. React 19 peer dependency support from 1.2.0
  2. The tsup build fix from PR revert: prior changes and build with React 18 #127

Evidence

The bundled files in 1.2.2 contain the problematic .js extension:

  // node_modules/@yext/pages-components/dist/index-0El3OWzn.js
  import { jsx as P, jsxs as Ye, Fragment as st } from "react/jsx-runtime.js";

Whereas 1.2.1 has correct imports:

  // node_modules/@yext/pages-components/dist/index-GeO8DZvj.js
  import { jsx as P, jsxs as Ye, Fragment as st } from "react/jsx-runtime";

Workaround

Pin to version 1.2.1:

"@yext/pages-components": "1.2.1"

Environment

  • Node: 22.x / 24.x
  • Next.js: 15.5.9
  • React: 19.1.0
  • @yext/pages-components: 1.2.2

System Info

Binaries:
    Node: 22.13.0 - /Users/christophersnyder/.nvm/versions/node/v22.13.0/bin/node
    npm: 11.3.0 - /Users/christophersnyder/.nvm/versions/node/v22.13.0/bin/npm
 npmPackages:
   @types/react: ^19.1.2 => 19.2.7
@types/react-dom: ^19.1.2 => 19.2.3
next: ^15.3.1 => 15.5.9
react: ^19.1.0 => 19.2.3
typescript: ^5 => 5.9.3
react-dom: ^19.1.0 => 19.2.3

Used Package Manager

npm

Used Browser

Chrome

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions