Skip to content

Commit d98c8a7

Browse files
caoxiemeihaobluwy
andauthored
chore: use 'new URL' instead of 'url.parse' (#8254)
Co-authored-by: bluwy <[email protected]>
1 parent 0b25cc1 commit d98c8a7

File tree

1 file changed

+1
-2
lines changed
  • packages/vite/src/node/server/middlewares

1 file changed

+1
-2
lines changed

packages/vite/src/node/server/middlewares/base.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { parse as parseUrl } from 'url'
21
import type { Connect } from 'types/connect'
32
import type { ViteDevServer } from '..'
43

@@ -12,7 +11,7 @@ export function baseMiddleware({
1211
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
1312
return function viteBaseMiddleware(req, res, next) {
1413
const url = req.url!
15-
const parsed = parseUrl(url)
14+
const parsed = new URL(url, 'http://vitejs.dev')
1615
const path = parsed.pathname || '/'
1716

1817
if (path.startsWith(base)) {

0 commit comments

Comments
 (0)