Skip to content

Commit

Permalink
fix: normalize away base in imported URLs
Browse files Browse the repository at this point in the history
This fixes hot-reloading issues reported in vitejs#5063.
  • Loading branch information
fwouts committed Sep 24, 2021
1 parent 4b84c0d commit 6dba01b
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 @@ -312,7 +312,7 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
str().prepend(importsString)
str().overwrite(expStart, endIndex, exp)
imports.forEach((url) => {
importedUrls.add(url)
importedUrls.add(url.replace(base, '/'))
if (isEager) staticImportedUrls.add(url)
})
if (!(importerModule.file! in server._globImporters)) {
Expand Down Expand Up @@ -411,7 +411,7 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {

// record for HMR import chain analysis
// make sure to normalize away base
importedUrls.add(url)
importedUrls.add(url.replace(base, '/'))
if (!isDynamicImport) {
// for pre-transforming
staticImportedUrls.add(url)
Expand Down

0 comments on commit 6dba01b

Please sign in to comment.