Skip to content

Commit

Permalink
chore: use 'new URL' instead of 'url.parse' (#8254)
Browse files Browse the repository at this point in the history
Co-authored-by: bluwy <bjornlu.dev@gmail.com>
  • Loading branch information
caoxiemeihao and bluwy committed May 22, 2022
1 parent 0b25cc1 commit d98c8a7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/vite/src/node/server/middlewares/base.ts
@@ -1,4 +1,3 @@
import { parse as parseUrl } from 'url'
import type { Connect } from 'types/connect'
import type { ViteDevServer } from '..'

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

if (path.startsWith(base)) {
Expand Down

0 comments on commit d98c8a7

Please sign in to comment.