Skip to content

Commit

Permalink
Added comment explaining use of regex replace
Browse files Browse the repository at this point in the history
  • Loading branch information
GrygrFlzr committed Mar 21, 2021
1 parent 5b5ee9d commit 2a5d131
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/vite/src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ export function removeImportQuery(url: string) {
}

export function injectQuery(url: string, queryToInject: string) {
// encode percents for consistent behavior with pathToFileURL
// see #2614 for details
let resolvedUrl = new URL(url.replace(/%/g, '%25'), 'relative:///')
if (resolvedUrl.protocol !== 'relative:') {
resolvedUrl = pathToFileURL(url)
Expand Down

0 comments on commit 2a5d131

Please sign in to comment.