Skip to content

Commit 9f44019

Browse files
authored
Update Vite to 6.0.0 (#12524)
1 parent a2f90ce commit 9f44019

File tree

31 files changed

+694
-1196
lines changed

31 files changed

+694
-1196
lines changed

.changeset/breezy-brooms-count.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': major
3+
---
4+
5+
Bumps Vite to ^6.0.1 and handles its breaking changes

.changeset/eighty-crabs-cross.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@astrojs/solid-js': patch
3+
---
4+
5+
Updates vite-plugin-solid to handle Vite 6

.changeset/lemon-frogs-wait.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@astrojs/svelte': major
3+
---
4+
5+
Updates `@sveltejs/vite-plugin-svelte` to v5 to handle Vite 6

.changeset/slimy-jeans-train.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@astrojs/preact': major
3+
'@astrojs/svelte': major
4+
'@astrojs/react': major
5+
'@astrojs/solid-js': major
6+
'@astrojs/vue': major
7+
---
8+
9+
Updates Vite dependency to v6 to match Astro v5

examples/container-with-vitest/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
"test": "vitest run"
1212
},
1313
"dependencies": {
14-
"astro": "^5.0.0-beta.11",
1514
"@astrojs/react": "^3.7.0-beta.1",
15+
"astro": "^5.0.0-beta.11",
1616
"react": "^18.3.1",
1717
"react-dom": "^18.3.1",
18-
"vitest": "^2.1.4"
18+
"vitest": "^2.1.6"
1919
},
2020
"devDependencies": {
2121
"@types/react": "^18.3.12",

examples/with-tailwindcss/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"astro": "^5.0.0-beta.11",
1717
"autoprefixer": "^10.4.20",
1818
"canvas-confetti": "^1.9.3",
19-
"postcss": "^8.4.47",
19+
"postcss": "^8.4.49",
2020
"tailwindcss": "^3.4.14"
2121
}
2222
}

examples/with-vitest/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
},
1313
"dependencies": {
1414
"astro": "^5.0.0-beta.11",
15-
"vitest": "^2.1.4"
15+
"vitest": "^2.1.6"
1616
}
1717
}

package.json

-4
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@
7272
"typescript-eslint": "^8.13.0"
7373
},
7474
"pnpm": {
75-
"overrides": {
76-
"vitest>vite": "6.0.0-beta.6",
77-
"vite-node>vite": "6.0.0-beta.6"
78-
},
7975
"peerDependencyRules": {
8076
"allowAny": [
8177
"astro",

packages/astro/e2e/fixtures/tailwindcss/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"@astrojs/tailwind": "workspace:*",
77
"astro": "workspace:*",
88
"autoprefixer": "^10.4.20",
9-
"postcss": "^8.4.47",
9+
"postcss": "^8.4.49",
1010
"tailwindcss": "^3.4.14"
1111
}
1212
}

packages/astro/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@
167167
"ultrahtml": "^1.5.3",
168168
"unist-util-visit": "^5.0.0",
169169
"vfile": "^6.0.3",
170-
"vite": "6.0.0-beta.6",
171-
"vitefu": "^1.0.3",
170+
"vite": "^6.0.1",
171+
"vitefu": "^1.0.4",
172172
"which-pm": "^3.0.0",
173173
"xxhash-wasm": "^1.0.2",
174174
"yargs-parser": "^21.1.1",
@@ -215,7 +215,7 @@
215215
"sass": "^1.80.6",
216216
"undici": "^6.20.1",
217217
"unified": "^11.0.5",
218-
"vitest": "^2.1.1"
218+
"vitest": "^2.1.6"
219219
},
220220
"engines": {
221221
"node": "^18.17.1 || ^20.3.0 || >=21.0.0",

packages/astro/src/core/create-vite.ts

-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ export async function createVite(
216216
replacement: 'astro/components',
217217
},
218218
],
219-
conditions: ['astro'],
220219
// Astro imports in third-party packages should use the same version as root
221220
dedupe: ['astro'],
222221
},

packages/astro/src/vite-plugin-astro/index.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type {
88
CompileMetadata,
99
} from './types.js';
1010

11-
import { normalizePath } from 'vite';
11+
import { defaultClientConditions, defaultServerConditions, normalizePath } from 'vite';
1212
import type { AstroConfig } from '../types/public/config.js';
1313
import { hasSpecialQueries, normalizeFilename } from '../vite-plugin-utils/index.js';
1414
import { type CompileAstroResult, compileAstro } from './compile.js';
@@ -43,6 +43,18 @@ export default function astro({ settings, logger }: AstroPluginOptions): vite.Pl
4343
const prePlugin: vite.Plugin = {
4444
name: 'astro:build',
4545
enforce: 'pre', // run transforms before other plugins can
46+
async configEnvironment(name, viteConfig, opts) {
47+
viteConfig.resolve ??= {};
48+
// Emulate Vite default fallback for `resolve.conditions` if not set
49+
if (viteConfig.resolve.conditions == null) {
50+
if (viteConfig.consumer === 'client' || name === 'client' || opts.isSsrTargetWebworker) {
51+
viteConfig.resolve.conditions = [...defaultClientConditions];
52+
} else {
53+
viteConfig.resolve.conditions = [...defaultServerConditions];
54+
}
55+
}
56+
viteConfig.resolve.conditions.push('astro');
57+
},
4658
configResolved(viteConfig) {
4759
// Initialize `compile` function to simplify usage later
4860
compile = (code, filename) => {

packages/astro/test/config-vite.test.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'node:assert/strict';
22
import { before, describe, it } from 'node:test';
33
import * as cheerio from 'cheerio';
4-
import { resolveConfig } from 'vite';
4+
import { defaultClientConditions, resolveConfig } from 'vite';
55
import { getViteConfig } from '../dist/config/index.js';
66
import { loadFixture } from './test-utils.js';
77

@@ -28,9 +28,12 @@ describe('getViteConfig', () => {
2828
it('Does not change the default config.', async () => {
2929
const command = 'serve';
3030
const mode = 'test';
31-
const configFn = getViteConfig({});
31+
const configFn = getViteConfig({}, { logLevel: 'silent' });
3232
const config = await configFn({ command, mode });
3333
const resolvedConfig = await resolveConfig(config, command, mode);
34-
assert.deepStrictEqual(resolvedConfig.resolve.conditions, ['astro']);
34+
assert.deepStrictEqual(resolvedConfig.resolve.conditions, [
35+
...defaultClientConditions,
36+
'astro',
37+
]);
3538
});
3639
});

packages/astro/test/fixtures/postcss/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"@astrojs/vue": "workspace:*",
99
"astro": "workspace:*",
1010
"autoprefixer": "^10.4.20",
11-
"postcss": "^8.4.47",
11+
"postcss": "^8.4.49",
1212
"solid-js": "^1.9.3",
1313
"svelte": "^5.1.16",
1414
"vue": "^3.5.12"

packages/astro/test/fixtures/tailwindcss-ts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"dependencies": {
66
"@astrojs/tailwind": "workspace:*",
77
"astro": "workspace:*",
8-
"postcss": "^8.4.47",
8+
"postcss": "^8.4.49",
99
"tailwindcss": "^3.4.14"
1010
}
1111
}

packages/astro/test/fixtures/tailwindcss/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"@astrojs/tailwind": "workspace:*",
88
"astro": "workspace:*",
99
"autoprefixer": "^10.4.20",
10-
"postcss": "^8.4.47",
10+
"postcss": "^8.4.49",
1111
"tailwindcss": "^3.4.14"
1212
}
1313
}

packages/astro/test/fixtures/vitest/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
},
99
"dependencies": {
1010
"astro": "workspace:*",
11-
"vitest": "^2.1.1"
11+
"vitest": "^2.1.6"
1212
}
1313
}

packages/db/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,6 @@
9191
"astro-scripts": "workspace:*",
9292
"cheerio": "1.0.0",
9393
"typescript": "^5.6.3",
94-
"vite": "6.0.0-beta.6"
94+
"vite": "^6.0.1"
9595
}
9696
}

packages/db/test/fixtures/ticketing-example/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"@astrojs/check": "^0.9.4",
1313
"@astrojs/db": "workspace:*",
1414
"@astrojs/node": "^8.3.4",
15-
"@astrojs/react": "^3.6.2",
15+
"@astrojs/react": "workspace:*",
1616
"@types/react": "^18.3.12",
1717
"@types/react-dom": "^18.3.1",
1818
"astro": "workspace:*",

packages/integrations/alpinejs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@playwright/test": "1.48.2",
4242
"astro": "workspace:*",
4343
"astro-scripts": "workspace:*",
44-
"vite": "6.0.0-beta.6"
44+
"vite": "^6.0.1"
4545
},
4646
"publishConfig": {
4747
"provenance": true

packages/integrations/markdoc/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"astro-scripts": "workspace:*",
8080
"devalue": "^5.1.1",
8181
"linkedom": "^0.18.5",
82-
"vite": "6.0.0-beta.6"
82+
"vite": "^6.0.1"
8383
},
8484
"engines": {
8585
"node": "^18.17.1 || ^20.3.0 || >=21.0.0"

packages/integrations/mdx/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"remark-toc": "^9.0.0",
7171
"shiki": "^1.22.2",
7272
"unified": "^11.0.5",
73-
"vite": "6.0.0-beta.6"
73+
"vite": "^6.0.1"
7474
},
7575
"engines": {
7676
"node": "^18.17.1 || ^20.3.0 || >=21.0.0"

packages/integrations/preact/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@preact/signals": "^1.3.0",
4242
"babel-plugin-transform-hook-names": "^1.0.2",
4343
"preact-render-to-string": "^6.5.11",
44-
"vite": "^5.4.10"
44+
"vite": "^6.0.1"
4545
},
4646
"devDependencies": {
4747
"astro": "workspace:*",

packages/integrations/react/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
"test": "astro-scripts test \"test/**/*.test.js\""
5050
},
5151
"dependencies": {
52-
"@vitejs/plugin-react": "^4.3.3",
52+
"@vitejs/plugin-react": "^4.3.4",
5353
"ultrahtml": "^1.5.3",
54-
"vite": "6.0.0-beta.6"
54+
"vite": "^6.0.1"
5555
},
5656
"devDependencies": {
5757
"@types/react": "^18.3.12",

packages/integrations/solid/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
"dev": "astro-scripts dev \"src/**/*.ts\""
3636
},
3737
"dependencies": {
38-
"vite-plugin-solid": "^2.10.2",
39-
"vite": "6.0.0-beta.6"
38+
"vite-plugin-solid": "^2.11.0",
39+
"vite": "^6.0.1"
4040
},
4141
"devDependencies": {
4242
"astro": "workspace:*",

packages/integrations/solid/src/index.ts

+3-31
Original file line numberDiff line numberDiff line change
@@ -45,43 +45,15 @@ async function getDevtoolsPlugin(logger: AstroIntegrationLogger, retrieve: boole
4545
}
4646
}
4747

48-
async function getViteConfiguration(
49-
isDev: boolean,
48+
function getViteConfiguration(
5049
{ include, exclude }: Options,
5150
devtoolsPlugin: DevtoolsPlugin | null,
5251
) {
53-
// https://github.com/solidjs/vite-plugin-solid
54-
// We inject the dev mode only if the user explicitly wants it or if we are in dev (serve) mode
55-
const nestedDeps = ['solid-js', 'solid-js/web', 'solid-js/store', 'solid-js/html', 'solid-js/h'];
5652
const config: UserConfig = {
57-
resolve: {
58-
conditions: ['solid', ...(isDev ? ['development'] : [])],
59-
dedupe: nestedDeps,
60-
alias: [{ find: /^solid-refresh$/, replacement: '/@solid-refresh' }],
61-
},
6253
optimizeDeps: {
63-
include: [...nestedDeps],
6454
exclude: ['@astrojs/solid-js/server.js'],
6555
},
66-
plugins: [
67-
solid({ include, exclude, dev: isDev, ssr: true }),
68-
{
69-
name: '@astrojs/solid:config-overrides',
70-
enforce: 'post',
71-
config() {
72-
return {
73-
esbuild: {
74-
// To support using alongside other JSX frameworks, still let
75-
// esbuild compile stuff. Solid goes first anyways.
76-
include: /\.(m?ts|[jt]sx)$/,
77-
},
78-
};
79-
},
80-
},
81-
],
82-
ssr: {
83-
external: ['babel-preset-solid'],
84-
},
56+
plugins: [solid({ include, exclude, ssr: true })],
8557
};
8658

8759
if (devtoolsPlugin) {
@@ -128,7 +100,7 @@ export default function (options: Options = {}): AstroIntegration {
128100

129101
addRenderer(getRenderer());
130102
updateConfig({
131-
vite: await getViteConfiguration(command === 'dev', options, devtoolsPlugin),
103+
vite: getViteConfiguration(options, devtoolsPlugin),
132104
});
133105

134106
if (devtoolsPlugin) {

packages/integrations/svelte/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
"dev": "astro-scripts dev \"src/**/*.ts\""
4040
},
4141
"dependencies": {
42-
"@sveltejs/vite-plugin-svelte": "^4.0.0",
42+
"@sveltejs/vite-plugin-svelte": "^5.0.1",
4343
"svelte2tsx": "^0.7.22",
44-
"vite": "6.0.0-beta.6"
44+
"vite": "^6.0.1"
4545
},
4646
"devDependencies": {
4747
"astro": "workspace:*",

packages/integrations/tailwind/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@
3636
},
3737
"dependencies": {
3838
"autoprefixer": "^10.4.20",
39-
"postcss": "^8.4.47",
39+
"postcss": "^8.4.49",
4040
"postcss-load-config": "^4.0.2"
4141
},
4242
"devDependencies": {
4343
"astro": "workspace:*",
4444
"astro-scripts": "workspace:*",
4545
"tailwindcss": "^3.4.14",
46-
"vite": "6.0.0-beta.6"
46+
"vite": "^6.0.1"
4747
},
4848
"peerDependencies": {
4949
"astro": "^3.0.0 || ^4.0.0 || ^5.0.0-beta.0",

packages/integrations/vue/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242
"test": "astro-scripts test \"test/**/*.test.js\""
4343
},
4444
"dependencies": {
45-
"@vitejs/plugin-vue": "^5.1.4",
45+
"@vitejs/plugin-vue": "^5.2.1",
4646
"@vitejs/plugin-vue-jsx": "^4.0.1",
4747
"@vue/compiler-sfc": "^3.5.12",
48-
"vite-plugin-vue-devtools": "^7.6.3",
49-
"vite": "6.0.0-beta.6"
48+
"vite": "^6.0.1",
49+
"vite-plugin-vue-devtools": "^7.6.3"
5050
},
5151
"devDependencies": {
5252
"astro": "workspace:*",

packages/studio/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@
4242
"astro": "workspace:*",
4343
"astro-scripts": "workspace:*",
4444
"typescript": "^5.6.3",
45-
"vite": "6.0.0-beta.6"
45+
"vite": "^6.0.1"
4646
}
4747
}

0 commit comments

Comments
 (0)