Skip to content

Commit facdae6

Browse files
adriencacciaclaude
andcommitted
feat(vitest-plugin): add vite 8 support
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>
1 parent 9338d9a commit facdae6

4 files changed

Lines changed: 582 additions & 28 deletions

File tree

‎packages/vitest-plugin/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@
4040
},
4141
"peerDependencies": {
4242
"tinybench": ">=2.9.0",
43-
"vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0",
43+
"vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0",
4444
"vitest": "^3.2 || ^4"
4545
},
4646
"devDependencies": {
4747
"@total-typescript/shoehorn": "^0.1.1",
4848
"execa": "^8.0.1",
4949
"tinybench": "^2.9.0",
50-
"vite": "^7.0.0",
51-
"vitest": "^4.0.18"
50+
"vite": "^8.0.0",
51+
"vitest": "^4.1.11"
5252
}
5353
}

‎packages/vitest-plugin/rollup.config.mjs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ export default defineConfig([
1212
{
1313
input: "src/index.ts",
1414
output: { file: pkg.types, format: "es" },
15-
plugins: declarationsPlugin({ compilerOptions: { composite: false } }),
15+
plugins: declarationsPlugin({
16+
compilerOptions: { composite: false, preserveSymlinks: false },
17+
}),
18+
external: ["vite"],
1619
},
1720
{
1821
input: "src/globalSetup.ts",

‎packages/vitest-plugin/tsconfig.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"compilerOptions": {
44
"outDir": "dist",
55
"rootDir": "src",
6+
"moduleResolution": "bundler",
67
"typeRoots": ["node_modules/@types", "../../node_modules/@types"]
78
},
89
"references": [{ "path": "../core" }],

0 commit comments

Comments
 (0)