Skip to content

Commit c11c3ea

Browse files
committed
chore: still define but throw when called
1 parent f8c05b4 commit c11c3ea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/vite-node/src/client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,10 @@ export class ViteNodeRunner {
315315
catch {
316316
// old Node throws when invalid path
317317
}
318-
if (ok) {
319-
(meta as any).resolve
320-
= (specifier: string, parent?: string | URL) =>
321-
import.meta.resolve(specifier, parent ?? href)
318+
(meta as any).resolve = (specifier: string, parent?: string | URL) => {
319+
if (!ok)
320+
throw new Error('[vite-node] "--experimental-import-meta-resolve" is required to enable "import.meta.resolve"')
321+
return import.meta.resolve(specifier, parent ?? href)
322322
}
323323
}
324324

0 commit comments

Comments
 (0)