Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit d60cebd

Browse files
committed
fix parseModuleExportNames method
1 parent c200434 commit d60cebd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

server/aleph.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,17 @@ export class Aleph implements IAleph {
784784
const code = (new TextDecoder).decode(content)
785785
const names = await parseExportNames(specifier, code, { sourceType })
786786
return (await Promise.all(names.map(async name => {
787-
if (name.startsWith('{') && name.startsWith('}')) {
788-
return await this.parseModuleExportNames(name.slice(1, -1))
787+
if (name.startsWith('{') && name.endsWith('}')) {
788+
let dep = name.slice(1, -1)
789+
if (util.isLikelyHttpURL(specifier)) {
790+
const url = new URL(specifier)
791+
if (dep.startsWith('/')) {
792+
dep = url.protocol + '//' + url.host + dep
793+
} else {
794+
dep = url.protocol + '//' + url.host + join(url.pathname, dep)
795+
}
796+
}
797+
return await this.parseModuleExportNames(dep)
789798
}
790799
return name
791800
}))).flat()

0 commit comments

Comments
 (0)