Skip to content

Commit

Permalink
fix(importAnalysis): backport #13712, strip url base before passing a…
Browse files Browse the repository at this point in the history
…s safeModulePaths
  • Loading branch information
sapphi-red authored and patak-dev committed Sep 17, 2024
1 parent 7d78ae7 commit 5d1d81e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,9 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
const [url, resolvedId] = await normalizeUrl(specifier, start)

// record as safe modules
server?.moduleGraph.safeModulesPath.add(fsPathFromUrl(url))
const urlWithoutBase =
base !== '/' && url.startsWith(base) ? url.replace(base, '/') : url
server?.moduleGraph.safeModulesPath.add(fsPathFromUrl(urlWithoutBase))

if (url !== specifier) {
let rewriteDone = false
Expand Down

0 comments on commit 5d1d81e

Please sign in to comment.