fix: ensure importer is normalised before resolving relative imports

This commit is contained in:
Daniel Roe 2024-10-06 06:17:34 +01:00
parent 6133fe62d6
commit 1a375d638c
No known key found for this signature in database
GPG Key ID: CBC814C393D93268

View File

@ -43,6 +43,9 @@ export const VirtualFSPlugin = (nuxt = useNuxt(), options: VirtualFSPluginOption
} }
if (importer && !isAbsolute(id)) { if (importer && !isAbsolute(id)) {
if (importer.startsWith(PREFIX)) {
importer = importer.slice(PREFIX.length)
}
const resolved = resolveWithExt(join(dirname(importer), id)) const resolved = resolveWithExt(join(dirname(importer), id))
if (resolved) { if (resolved) {
return PREFIX + resolved return PREFIX + resolved