Skip to content

feat(vitest-plugin): add vite 8 support - #74

Draft
adriencaccia wants to merge 2 commits into
mainfrom
feat/vite-8-support
Draft

feat(vitest-plugin): add vite 8 support#74
adriencaccia wants to merge 2 commits into
mainfrom
feat/vite-8-support

Conversation

@adriencaccia

@adriencacciaadriencaccia commented Mar 23, 2026

Copy link
Copy Markdown
Member

Add Vite 8 to the supported peer dependency range for @codspeed/vitest-plugin.

Vite 8 replaces esbuild and Rollup with Rolldown and Oxc. This changes the internal Plugin type inheritance chain (Plugin now extends Rolldown.Plugin). The vitest-plugin only uses basic plugin hooks (name, apply, enforce, config) — none of which are affected by Vite 8's breaking changes.

Changes:

  • Add ^8.0.0 to peerDependencies.vite
  • Bump devDependencies.vite from ^7.0.0 to ^8.0.0
  • Add rolldown as a dev dependency — needed because pnpm's strict isolation doesn't hoist rolldown (a transitive dep of Vite 8), and TypeScript needs it to resolve Rolldown.Plugin in the type chain

Vite 8 breaking changes reviewed (none affect this plugin):

  • Rolldown replaces esbuild/Rollup — plugin doesn't use bundler APIs
  • moduleType: 'js' required in load/transform hooks — plugin doesn't use these hooks
  • Removed hooks (shouldTransformCachedModule, resolveImportMeta, etc.) — not used
  • build.rollupOptionsbuild.rolldownOptions — not used
  • esbuild → oxc config migration — not used

Note: Vite 8 requires Node.js ^20.19.0 || >=22.12.0. CI may need a Node.js bump to run integration tests against Vite 8. See #76.

Vitest v4 support was already in place (^3.2 || ^4 peer dep, ^4.0.18 dev dep) — no changes needed there.

adriencacciaand others added 2 commits March 23, 2026 16:52
Add vite ^8.0.0 to the peer dependency range and bump the dev
dependency to test against the latest. Vite 8 replaces esbuild/Rollup
with Rolldown, which changes the Plugin type's inheritance chain.
Add rolldown as a dev dependency so pnpm can resolve the transitive
types needed for the build.
Co-Authored-By: Claude <noreply@anthropic.com>
Vite 8 removed the `main` and `types` top-level fields from its
package.json, relying entirely on the `exports` map. Since the base
tsconfig uses `moduleResolution: "node"` (TypeScript 4.9.4), the
compiler cannot resolve `import { Plugin } from "vite"` without
an explicit path mapping.
Co-Authored-By: Claude <noreply@anthropic.com>
@codspeed-hq

Copy link
Copy Markdown

Merging this PR will degrade performance by 99.97%

⚠️Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 3 improved benchmarks
❌ 10 regressed benchmarks
✅ 155 untouched benchmarks

⚠️Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

ModeBenchmarkBASEHEADEfficiency
Memorywait 500ms39.1 KB64.1 KB-39.05%
Memorywait 500ms15 KB64.1 KB-76.63%
Memoryrecursive fibo 1519 B65,624 B-99.97%
Memorywait 1ms7 B10 B-30%
Simulationwait 500ms8.7 ms12 ms-28.05%
Simulationwait 1sec19.2 ms22.5 ms-14.38%
Simulationone585 µs407.6 µs+43.53%
Simulationwait 500ms10.5 ms11.9 ms-12.01%
WallTimeshort body1.5 µs1.9 µs-20.65%
WallTimeswitch 2312 ns348 ns-10.34%
WallTimeshort body2.1 µs1.7 µs+21.28%
WallTimeshort body2.1 µs1.7 µs+25%
WallTimefibo 3029.9 ms34.1 ms-12.47%

Comparing feat/vite-8-support (1a48730) with main (4f97cbe)

Open in CodSpeed

@tats-u

Copy link
Copy Markdown

This branch has conflicts that must be resolved

@adriencaccia

Copy link
Copy Markdown
MemberAuthor

This branch has conflicts that must be resolved

@tats-u as stated in the PR description, to push this pr we need to first bump the node version of the repo. More info in #76

@tats-u

tats-u commented Jul 21, 2026

Copy link
Copy Markdown

I don't think this is necessary. Either of the following options should be sufficient:

  • Implement a dedicated workflow and project (package.json) for older Node versions, limiting testing scope (install using the latest Node until just before testing, then switch back)
  • Reduce support level for older Node versions to "as-is" or "may address bug reports only if they come in"

It's important to note that the 20.19 release was over a year ago.

@tats-u

tats-u commented Jul 21, 2026

Copy link
Copy Markdown

If you want to detect whether Vite is v8, you can use this.meta.rolldownVersion.

Sign up for freeto 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.

2 participants

@adriencaccia@tats-u