Skip to content

Commit 5d1d81e

Browse files
sapphi-redpatak-dev
authored andcommitted
fix(importAnalysis): backport #13712, strip url base before passing as safeModulePaths
1 parent 7d78ae7 commit 5d1d81e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/vite/src/node/plugins/importAnalysis.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,9 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
478478
const [url, resolvedId] = await normalizeUrl(specifier, start)
479479

480480
// record as safe modules
481-
server?.moduleGraph.safeModulesPath.add(fsPathFromUrl(url))
481+
const urlWithoutBase =
482+
base !== '/' && url.startsWith(base) ? url.replace(base, '/') : url
483+
server?.moduleGraph.safeModulesPath.add(fsPathFromUrl(urlWithoutBase))
482484

483485
if (url !== specifier) {
484486
let rewriteDone = false

0 commit comments

Comments
 (0)