Skip to content

Commit

Permalink
perf: improve cleanUrl util (#12573)
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Mar 25, 2023
1 parent e9b92f5 commit 68d500e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/vite/src/node/utils.ts
Expand Up @@ -256,10 +256,11 @@ export function ensureVolumeInPath(file: string): string {
}

export const queryRE = /\?.*$/s
export const hashRE = /#.*$/s

export const cleanUrl = (url: string): string =>
url.replace(hashRE, '').replace(queryRE, '')
const postfixRE = /[?#].*$/s
export function cleanUrl(url: string): string {
return url.replace(postfixRE, '')
}

export const externalRE = /^(https?:)?\/\//
export const isExternalUrl = (url: string): boolean => externalRE.test(url)
Expand Down

0 comments on commit 68d500e

Please sign in to comment.