Skip to content

Commit

Permalink
only encode when url is written to code
Browse files Browse the repository at this point in the history
  • Loading branch information
pzerelles committed Dec 15, 2023
1 parent ac8ad81 commit 6174878
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
url = joinUrlSegments(base, url)
}

return [encodeURI(url), resolved.id]
return [url, resolved.id]
}

const orderedImportedUrls = new Array<string | undefined>(imports.length)
Expand Down Expand Up @@ -599,7 +599,7 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
rewriteDone = true
}
if (!rewriteDone) {
const rewrittenUrl = JSON.stringify(url)
const rewrittenUrl = JSON.stringify(encodeURI(url))
const s = isDynamicImport ? start : start - 1
const e = isDynamicImport ? end : end + 1
str().overwrite(s, e, rewrittenUrl, {
Expand Down

0 comments on commit 6174878

Please sign in to comment.