Skip to content

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Dec 10, 2025

Bumps @vitejs/plugin-react from 4.7.0 to 5.1.2.

Release notes

Sourced from @​vitejs/plugin-react's releases.

[email protected]

No release notes provided.

[email protected]

Update code to support newer rolldown-vite (#976)

rolldown-vite will remove optimizeDeps.rollupOptions in favor of optimizeDeps.rolldownOptions soon. This plugin now uses optimizeDeps.rolldownOptions to support newer rolldown-vite. Please update rolldown-vite to the latest version if you are using an older version.

[email protected]

Add @vitejs/plugin-react/preamble virtual module for SSR HMR (#890)

SSR applications can now initialize HMR runtime by importing @vitejs/plugin-react/preamble at the top of their client entry instead of manually calling transformIndexHtml. This simplifies SSR setup for applications that don't use the transformIndexHtml API.

Fix raw Rolldown support for Rolldown 1.0.0-beta.44+ (#930)

Rolldown 1.0.0-beta.44+ removed the top-level jsx option in favor of transform.jsx. This plugin now uses the transform.jsx option to support Rolldown 1.0.0-beta.44+.

[email protected]

Perf: use native refresh wrapper plugin in rolldown-vite (#881)

[email protected]

HMR did not work for components imported with queries with rolldown-vite (#872)

Perf: simplify refresh wrapper generation (#835)

[email protected]

Skip transform hook completely in rolldown-vite in dev if possible (#783)

[email protected]

Set optimizeDeps.rollupOptions.transform.jsx instead of optimizeDeps.rollupOptions.jsx for rolldown-vite (#735)

optimizeDeps.rollupOptions.jsx is going to be deprecated in favor of optimizeDeps.rollupOptions.transform.jsx.

Perf: skip babel-plugin-react-compiler if code has no "use memo" when { compilationMode: "annotation" } (#734)

Respect tsconfig jsxImportSource (#726)

Fix reactRefreshHost option on rolldown-vite (#716)

Fix RefreshRuntime being injected twice for class components on rolldown-vite (#708)

Skip babel-plugin-react-compiler on non client environment (689)

[email protected]

(Same content as v5.0.0-beta.0 https://github.com/vitejs/vite-plugin-react/releases/tag/plugin-react%405.0.0-beta.0)

Use Oxc for react refresh transform in rolldown-vite

When used with rolldown-vite, this plugin now uses Oxc for react refresh transform.

... (truncated)

Changelog

Sourced from @​vitejs/plugin-react's changelog.

5.1.2 (2025-12-08)

5.1.1 (2025-11-12)

Update code to support newer rolldown-vite (#976)

rolldown-vite will remove optimizeDeps.rollupOptions in favor of optimizeDeps.rolldownOptions soon. This plugin now uses optimizeDeps.rolldownOptions to support newer rolldown-vite. Please update rolldown-vite to the latest version if you are using an older version.

5.1.0 (2025-10-24)

Add @vitejs/plugin-react/preamble virtual module for SSR HMR (#890)

SSR applications can now initialize HMR runtime by importing @vitejs/plugin-react/preamble at the top of their client entry instead of manually calling transformIndexHtml. This simplifies SSR setup for applications that don't use the transformIndexHtml API.

Fix raw Rolldown support for Rolldown 1.0.0-beta.44+ (#930)

Rolldown 1.0.0-beta.44+ removed the top-level jsx option in favor of transform.jsx. This plugin now uses the transform.jsx option to support Rolldown 1.0.0-beta.44+.

5.0.4 (2025-09-27)

Perf: use native refresh wrapper plugin in rolldown-vite (#881)

5.0.3 (2025-09-17)

HMR did not work for components imported with queries with rolldown-vite (#872)

Perf: simplify refresh wrapper generation (#835)

5.0.2 (2025-08-28)

Skip transform hook completely in rolldown-vite in dev if possible (#783)

5.0.1 (2025-08-19)

Set optimizeDeps.rollupOptions.transform.jsx instead of optimizeDeps.rollupOptions.jsx for rolldown-vite (#735)

optimizeDeps.rollupOptions.jsx is going to be deprecated in favor of optimizeDeps.rollupOptions.transform.jsx.

Perf: skip babel-plugin-react-compiler if code has no "use memo" when { compilationMode: "annotation" } (#734)

Respect tsconfig jsxImportSource (#726)

Fix reactRefreshHost option on rolldown-vite (#716)

Fix RefreshRuntime being injected twice for class components on rolldown-vite (#708)

Skip babel-plugin-react-compiler on non client environment (689)

5.0.0 (2025-08-07)

... (truncated)

Commits
Maintainer changes

This version was pushed to npm by [GitHub Actions](https://www.npmjs.com/~GitHub Actions), a new releaser for @​vitejs/plugin-react since your current version.


Dependabot compatibility score

You can trigger a rebase of this PR by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

@dependabot dependabot bot added dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code labels Dec 10, 2025
@mahula
Copy link
Collaborator

mahula commented Dec 27, 2025

@dependabot rebase

@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/vitejs/plugin-react-5.1.2 branch from 52f4985 to bdad8ed Compare December 27, 2025 08:35
@mahula
Copy link
Collaborator

mahula commented Dec 27, 2025

@dependabot rebase

@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Dec 27, 2025

Looks like this PR is already up-to-date with main! If you'd still like to recreate it from scratch, overwriting any edits, you can request @dependabot recreate.

@mahula
Copy link
Collaborator

mahula commented Dec 27, 2025

@dependabot recreate

@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/vitejs/plugin-react-5.1.2 branch from bdad8ed to 03cd5f2 Compare December 27, 2025 08:44
@mahula
Copy link
Collaborator

mahula commented Feb 3, 2026

@dependabot rebase

Bumps [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react) from 4.7.0 to 5.1.2.
- [Release notes](https://github.com/vitejs/vite-plugin-react/releases)
- [Changelog](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite-plugin-react/commits/[email protected]/packages/plugin-react)

---
updated-dependencies:
- dependency-name: "@vitejs/plugin-react"
  dependency-version: 5.1.2
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/vitejs/plugin-react-5.1.2 branch from 03cd5f2 to 6d94839 Compare February 3, 2026 04:51
@mahula
Copy link
Collaborator

mahula commented Feb 3, 2026

Build Failure Details

Error Message:

[plugin typescript] vite.config.ts (1:19): @rollup/plugin-typescript TS2307: 
Cannot find module '@vitejs/plugin-react' or its corresponding type declarations.

Failing Workflow: build:lib / Build (push)
Failing Step: npm run build in lib/ directory


Root Cause Analysis

1. Package Structure Change in v5.x

The @vitejs/plugin-react package changed its export strategy between v4 and v5:

v4.x package.json:

{
  "main": "./dist/index.cjs",
  "types": "./dist/index.d.ts",
  "exports": {
    ".": {
      "types": "./dist/index.d.ts",
      "import": "./dist/index.mjs",
      "require": "./dist/index.cjs"
    }
  }
}

v5.x package.json:

{
  "type": "module",
  "exports": {
    ".": "./dist/index.js",
    "./preamble": "./types/preamble.d.ts"
  }
  // NO "main" field
  // NO "types" field
}

2. TypeScript Module Resolution Mismatch

The project's tsconfig.base.json uses:

{
  "moduleResolution": "Node"
}

This legacy resolution mode (also called "Node10"):

  • Does NOT support the exports field in package.json
  • Requires types, typings, or main fields as fallbacks
  • Falls back to looking for index.d.ts in package root

Since v5.x removed all fallback fields, TypeScript cannot find the type declarations.

3. Build Pipeline Trigger

The error occurs during the Rollup build because:

  1. lib/tsconfig.json includes vite.config.ts in compilation:

    "include": ["src", "vite.config.ts", ...]
  2. lib/vite.config.ts imports the plugin:

    import react from '@vitejs/plugin-react'
  3. lib/rollup.config.js uses @rollup/plugin-typescript with noEmitOnError: true:

    typescript({
      tsconfig: './tsconfig.json',
      noEmitOnError: true,
    })
  4. TypeScript fails to resolve the module → Rollup build fails


Solution Options

Option A: Update moduleResolution (Recommended)

Change tsconfig.base.json to use modern module resolution:

{
  "compilerOptions": {
    "moduleResolution": "Bundler"
  }
}

Pros:

  • Proper fix that enables modern ESM package support
  • Future-proof for other packages using exports field
  • Aligns with Vite's recommended TypeScript configuration

Cons:

  • May require testing across the entire codebase
  • Could surface other module resolution issues

Required Changes:

  • tsconfig.base.json: Change "moduleResolution": "Node" to "moduleResolution": "Bundler"

Option B: Separate Build tsconfig

Create a dedicated tsconfig for Rollup that excludes vite.config.ts:

New file: lib/tsconfig.build.json

{
  "extends": "./tsconfig.json",
  "include": ["src"],
  "exclude": ["node_modules", "dist", "example", "vite.config.ts", "setupTest.ts", "cypress.config.ts", "cypress"]
}

Update lib/rollup.config.js:

typescript({
  tsconfig: './tsconfig.build.json',
  noEmitOnError: true,
})

Pros:

  • Minimal change, isolated to build process
  • No risk to other parts of the codebase

Cons:

  • Workaround rather than proper fix
  • Adds configuration complexity
  • Doesn't address the underlying moduleResolution issue

Option C: Wait for Upstream Fix

The missing types field in @vitejs/[email protected] could be considered a regression. The package should include:

{
  "types": "./dist/index.d.ts"
}

Action: Report issue to https://github.com/vitejs/vite-plugin-react

Pros:

  • No changes needed to this codebase

Cons:

  • Uncertain timeline
  • Blocks the upgrade indefinitely

Additional Breaking Changes in v5.x

Node.js Engine Requirement

// v4.x
"engines": { "node": "^14.18.0 || >=16.0.0" }

// v5.x  
"engines": { "node": "^20.19.0 || >=22.12.0" }

Status: ✅ Compatible (project uses Node.js 22.20.0)

Dependency Changes

Dependency v4.x v5.x
@babel/core ^7.28.0 ^7.29.0
@rolldown/pluginutils 1.0.0-beta.27 1.0.0-rc.2
react-refresh ^0.17.0 ^0.18.0

Files Affected

File Change Required
tsconfig.base.json Update moduleResolution (Option A)
lib/tsconfig.build.json Create new file (Option B)
lib/rollup.config.js Update tsconfig path (Option B)

Testing Checklist

After implementing the fix:

  • cd lib && npm run build succeeds
  • cd lib && npm run test:unit passes
  • cd lib && npm run test:lint:eslint passes
  • cd app && npm run dev starts without errors
  • cd app && npm run build succeeds
  • Hot Module Replacement (HMR) works in development
  • All CI workflows pass

Reproduction Steps

To reproduce the build failure locally:

# Fetch the PR branch
git fetch origin dependabot/npm_and_yarn/vitejs/plugin-react-5.1.2

# Checkout the branch
git checkout origin/dependabot/npm_and_yarn/vitejs/plugin-react-5.1.2 --detach

# Clean install
rm -rf node_modules lib/node_modules app/node_modules

# Install from lib directory (simulates CI)
cd lib && npm install

# Attempt build (will fail)
npm run build

Recommendation

Implement Option A (update moduleResolution to "Bundler") as it:

  1. Properly fixes the underlying issue
  2. Aligns with modern TypeScript/Vite best practices
  3. Prepares the codebase for future ESM-only packages
  4. Is the recommended setting for Vite projects

After implementing the fix, rebase this PR and verify all CI checks pass.

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

Labels

dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant