Skip to content

Commit

Permalink
perf: improve multilineCommentsRE regex (fix #10689) (#10751)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkldshv committed Nov 3, 2022
1 parent 4a392f0 commit 51ed059
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vite/src/node/utils.ts
Expand Up @@ -912,7 +912,8 @@ export function toUpperCaseDriveLetter(pathName: string): string {
return pathName.replace(/^\w:/, (letter) => letter.toUpperCase())
}

export const multilineCommentsRE = /\/\*(.|[\r\n])*?\*\//gm
// Taken from https://stackoverflow.com/a/36328890
export const multilineCommentsRE = /\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//gm
export const singlelineCommentsRE = /\/\/.*/g
export const requestQuerySplitRE = /\?(?!.*[\/|\}])/

Expand Down

0 comments on commit 51ed059

Please sign in to comment.