Skip to content

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

Draft
adriencaccia wants to merge 1 commit into
mainfrom
feat/vite-8-support
Draft

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

Conversation

@adriencaccia

@adriencaccia adriencaccia commented Mar 23, 2026

Copy link
Copy Markdown
Member

Add Vite 8 to the supported peer dependency range for @codspeed/vitest-plugin, and test against it.

Vite 8 replaces esbuild and Rollup with Rolldown and Oxc. The plugin only uses name, apply, enforce and config, none of which are affected by the breaking changes. Two build-level adjustments were needed:

  • Vite 8 publishes its types through exports only, which the legacy moduleResolution: "node" cannot read, so the package now uses moduleResolution: "bundler".
  • rollup-plugin-dts forces preserveSymlinks: true, which stops TypeScript from reaching rolldown (a transitive dep of Vite 8) in a pnpm store and leaves Plugin without its base members. It is disabled for the declaration build, with vite kept external.

The vitest dev dependency moves to ^4.1.11: vitest depends on vite directly, and 4.1 is the first release accepting Vite 8, so without it the dev environment resolves two different vite copies and the plugin never actually runs on Vite 8.

Verified on Node 24.19.0:

  • pnpm turbo run lint typecheck test green (29/29) with --frozen-lockfile
  • dist/index.d.ts byte-identical to main, build emits no warnings
  • plugin benches pass on vitest 4.1.11 + vite 8.2.2 in all three runner modes (disabled, walltime, analysis)
  • packed the plugin into a standalone project on vite 8.2.2 + vitest 4.1.11: benches run, walltime results written, and the published .d.ts typechecks
  • backward compat: same tarball typechecks and benches on vite 7.3.6, and examples/with-vitest-v3 (vitest 3.2.4) and examples/with-typescript-esm (vitest 4.0.18) still pass on vite 7

Vitest 4.1 prints deprecation warnings for the vitest/runners and vitest/suite subpath imports the plugin uses. That is fixed by #75, stacked on this branch.

@codspeed-hq

codspeed-hq Bot commented Mar 23, 2026

Copy link
Copy Markdown

Merging this PR will regress 15 benchmarks

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ 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

⚡ 5 improved benchmarks
❌ 15 regressed benchmarks
✅ 218 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation recursive fibo 10 299.9 µs 1,372.5 µs -78.15%
Simulation switch 1 202.1 µs 534.3 µs -62.17%
WallTime fibo darwin 8.8 ms 11.9 ms -25.59%
Memory end 2 KB 2.6 KB -24.55%
Memory short body 656 B 784 B -16.33%
Memory short body 656 B 784 B -16.33%
Memory short body 656 B 784 B -16.33%
WallTime short body 1.9 µs 2.2 µs -14.29%
WallTime switch 1 72 ns 84 ns -14.29%
WallTime switch 1 72 ns 84 ns -14.29%
WallTime switch 2 84 ns 96 ns -12.5%
Memory two 1.8 KB 2.1 KB -11.94%
Memory one 2 KB 2.2 KB -11.27%
WallTime short body 1.9 µs 2.2 µs -10.56%
WallTime test sync baz 10 108 ns 120 ns -10%
Simulation test_recursive_fibo_10 11,699.9 µs 274.3 µs ×43
Simulation recursive fibo 10 1,371.7 µs 300.5 µs ×4.6
Memory wait 1sec 64.2 KB 20.3 KB ×3.2
WallTime test_recursive_cached_fibo_10 2.3 µs 2 µs +15.34%
WallTime switch 2 96 ns 84 ns +14.29%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing feat/vite-8-support (facdae6) with main (9338d9a)

Open in CodSpeed
@tats-u

tats-u commented Jul 21, 2026

Copy link
Copy Markdown

This branch has conflicts that must be resolved

@adriencaccia

Copy link
Copy Markdown
Member Author

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.

@ematipico

Copy link
Copy Markdown

@adriencaccia any chance to have this PR resurrected? If not, I am happy to take over the works. We need this (plus some other fixes) to make the plugin work at Starlight.

At the moment, our biggest blockers are:

@adriencaccia

Copy link
Copy Markdown
Member Author

@adriencaccia any chance to have this PR resurrected? If not, I am happy to take over the works. We need this (plus some other fixes) to make the plugin work at Starlight.

It seems the biggest blocker for vite 8 was bumping the node version of the repo as explained in #76.
So since it is fixed, we can take up this PR I think yes!

Regarding the setup/teardown, @GuillaumeLagrange do you remember why we closed #46?

@GuillaumeLagrange

Copy link
Copy Markdown
Contributor

Regarding the setup/teardown, @GuillaumeLagrange do you remember why we closed #46?

No particular reason comes to mind, I think it's just a branch that was forgotten and never merged

Accept vite 8 in the peer dependency range and test against it.

Vite 8 replaces esbuild and Rollup with Rolldown and Oxc. The plugin only
uses `name`, `apply`, `enforce` and `config`, none of which are affected
by the breaking changes, but two build-level adjustments are needed:

- Vite 8 publishes types through `exports` only, which the legacy
  `moduleResolution: "node"` cannot read. Switch the package to
  `moduleResolution: "bundler"`.
- rollup-plugin-dts forces `preserveSymlinks: true`, which prevents
  TypeScript from reaching `rolldown` (a transitive dependency of vite 8)
  in a pnpm store, leaving `Plugin` without its base members. Disable it
  for the declaration build and keep `vite` external.

Bump the vitest dev dependency to ^4.1.11: vitest depends on vite
directly, and 4.1 is the first release accepting vite 8, so without it
the dev environment resolves two different vite copies.

Co-Authored-By: Claude <noreply@anthropic.com>
@ematipico

Copy link
Copy Markdown

Thank you. It would be great to have those hooks fixed. For some reason, the benchmarks stale https://github.com/withastro/starlight/actions/runs/33494510505/job/99813536944?pr=4157 and we believe the cause is those hooks

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

Labels

None yet

4 participants