Skip to content

Commit ce0eec9

Browse files
authored
chore: upgrade to express 5 (#18537)
1 parent 87b2347 commit ce0eec9

File tree

22 files changed

+206
-118
lines changed

22 files changed

+206
-118
lines changed

.github/renovate.json5

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"typescript",
1919
"eslint-plugin-react-hooks", // prevent bumping to messy -rc-<hash>-<date>
2020
"@rollup/plugin-dynamic-import-vars", // prefer version using tinyglobby
21+
"@types/express", // express latest is still on v4, so types should also be v4
2122

2223
// pinned
2324
"slash3",

docs/guide/ssr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ This is statically replaced during build so it will allow tree-shaking of unused
6767
6868
## Setting Up the Dev Server
6969
70-
When building an SSR app, you likely want to have full control over your main server and decouple Vite from the production environment. It is therefore recommended to use Vite in middleware mode. Here is an example with [express](https://expressjs.com/):
70+
When building an SSR app, you likely want to have full control over your main server and decouple Vite from the production environment. It is therefore recommended to use Vite in middleware mode. Here is an example with [express](https://expressjs.com/) (v4):
7171
7272
```js{15-18} twoslash [server.js]
7373
import fs from 'node:fs'

playground/css-lightningcss-proxy/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
},
1111
"devDependencies": {
1212
"lightningcss": "^1.28.1",
13-
"express": "^4.21.1"
13+
"express": "^5.0.1"
1414
}
1515
}

playground/css-lightningcss-proxy/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export async function createServer(root = process.cwd(), hmrPort) {
4747
// use vite's connect instance as middleware
4848
app.use(vite.middlewares)
4949

50-
app.use('*', async (req, res, next) => {
50+
app.use('*all', async (req, res, next) => {
5151
try {
5252
let [url] = req.originalUrl.split('?')
5353
if (url.endsWith('/')) url += 'index.html'

playground/json/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"devDependencies": {
1616
"@vitejs/test-json-module": "file:./json-module",
17-
"express": "^4.21.1",
17+
"express": "^5.0.1",
1818
"vue": "^3.5.12"
1919
}
2020
}

playground/json/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export async function createServer(root = process.cwd(), hmrPort) {
3939
// use vite's connect instance as middleware
4040
app.use(vite.middlewares)
4141

42-
app.use('*', async (req, res) => {
42+
app.use('*all', async (req, res) => {
4343
try {
4444
let [url] = req.originalUrl.split('?')
4545
if (url.endsWith('/')) url += 'index.ssr.html'

playground/legacy/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"devDependencies": {
1818
"vite": "workspace:*",
1919
"@vitejs/plugin-legacy": "workspace:*",
20-
"express": "^4.21.1",
20+
"express": "^5.0.1",
2121
"terser": "^5.36.0"
2222
}
2323
}

playground/optimize-missing-deps/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
"@vitejs/test-missing-dep": "file:./missing-dep"
1111
},
1212
"devDependencies": {
13-
"express": "^4.21.1"
13+
"express": "^5.0.1"
1414
}
1515
}

playground/optimize-missing-deps/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function createServer(root = process.cwd(), hmrPort) {
3030
})
3131
app.use(vite.middlewares)
3232

33-
app.use('*', async (req, res) => {
33+
app.use('*all', async (req, res) => {
3434
try {
3535
let template = fs.readFileSync(resolve('index.html'), 'utf-8')
3636
template = await vite.transformIndexHtml(req.originalUrl, template)

playground/ssr-conditions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
"@vitejs/test-ssr-conditions-no-external": "file:./no-external"
1414
},
1515
"devDependencies": {
16-
"express": "^4.21.1"
16+
"express": "^5.0.1"
1717
}
1818
}

0 commit comments

Comments
 (0)