Skip to content

Commit bc6cafc

Browse files
committed
Path the pathname rather than fileURL
1 parent 9c6ab45 commit bc6cafc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/vite/src/node/ssr/ssrModuleLoader.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ async function nodeImport(
186186
} else {
187187
url = pathToFileURL(
188188
resolve(id, importer, config.root, !!config.resolve.preserveSymlinks)
189-
).toString()
189+
).pathname
190190
}
191191
const mod = await dynamicImport(url)
192192
return proxyESM(id, mod)
@@ -203,6 +203,9 @@ function proxyESM(id: string, mod: any) {
203203
if (isObject(mod.default) && prop in mod.default) {
204204
return mod.default[prop]
205205
}
206+
if (prop === 'then') {
207+
return undefined;
208+
}
206209
// throw an error like ESM import does
207210
throw new SyntaxError(
208211
`The requested module '${id}' does not provide an export named '${prop.toString()}'`

0 commit comments

Comments
 (0)