Skip to content

Commit

Permalink
refactor: better fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Jul 23, 2024
1 parent 48a3fd0 commit 052a18c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions packages/vite/src/node/plugins/importMetaGlob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,12 +563,7 @@ export async function toAbsoluteGlob(
custom: { 'vite:import-glob': { isSubImportsPattern } },
})) || glob,
)
// If matching a subpath import, the returned path is relative and doesn't look absolute.
// If it matches an alias that starts with `#`, the path will be absolute.
if (isSubImportsPattern && !isAbsolute(resolved)) {
return join(root, resolved)
}
if (isSubImportsPattern || isAbsolute(resolved)) {
if (isAbsolute(resolved)) {
return pre + globSafeResolvedPath(resolved, glob)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export function resolvePlugin(resolveOptions: InternalResolveOptions): Plugin {
id = resolvedImports

if (resolveOpts.custom?.['vite:import-glob']?.isSubImportsPattern) {
return id
return normalizePath(path.join(root, id))
}
}

Expand Down

0 comments on commit 052a18c

Please sign in to comment.