Skip to content

Commit 45e97e8

Browse files
authored
Support Vite 7 (#9773)
* Add Vite 7 as a peer dependency * Add changeset * Pin Vite version in E2E tests * Normalize main path used in optimizeDeps.entries * Revert Vite version range changes in E2E fixtures
1 parent 67130b3 commit 45e97e8

File tree

6 files changed

+367
-67
lines changed

6 files changed

+367
-67
lines changed

.changeset/olive-rabbits-tell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudflare/vite-plugin": minor
3+
---
4+
5+
Vite 7 is now supported and included as a peer dependency. We continue to also support Vite 6.

packages/vite-plugin-cloudflare/e2e/fixtures/invalid-worker-environment-options/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
},
88
"devDependencies": {
99
"@cloudflare/vite-plugin": "*",
10-
"vite": "^6.2.3"
10+
"vite": "^6.1.0"
1111
}
1212
}

packages/vite-plugin-cloudflare/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"vitest": "catalog:default"
6969
},
7070
"peerDependencies": {
71-
"vite": "catalog:vite-plugin",
71+
"vite": "^6.1.0 || ^7.0.0",
7272
"wrangler": "^3.101.0 || ^4.0.0"
7373
},
7474
"publishConfig": {

packages/vite-plugin-cloudflare/src/cloudflare-environment.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ export function createCloudflareEnvironmentOptions(
165165
optimizeDeps: {
166166
// Note: ssr pre-bundling is opt-in and we need to enable it by setting `noDiscovery` to false
167167
noDiscovery: false,
168-
entries: workerConfig.main,
168+
// We need to normalize the path as it is treated as a glob and backslashes are therefore treated as escape characters.
169+
entries: vite.normalizePath(workerConfig.main),
169170
exclude: [...cloudflareBuiltInModules],
170171
esbuildOptions: {
171172
platform: "neutral",

0 commit comments

Comments
 (0)