You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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):
Description
Version 1.2.2 of
@yext/pages-componentsintroduces 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
mainand switched to tsup, but no new version has been published to npm yet. Thelatesttag 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
react/jsx-runtimefrom build.jsextension rewrite for Node 20+Root Cause
PR #126 (commit
c70062e) added afixReactJsxRuntimeVite plugin that rewrites imports fromreact/jsx-runtimetoreact/jsx-runtime.jsto support React 17 + Node 20+.From the PR description:
However, React 18/19 properly use the
exportsfield in package.json, which only exports./jsx-runtime(without.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
Request
Please publish a new version (1.2.3 or 1.3.0) that includes:
Evidence
The bundled files in 1.2.2 contain the problematic .js extension:
Whereas 1.2.1 has correct imports:
Workaround
Pin to version 1.2.1:
"@yext/pages-components": "1.2.1"
Environment
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.3Used Package Manager
npm
Used Browser
Chrome
Validations