Skip to content

Commit

Permalink
chore: still define but throw when called
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Feb 13, 2024
1 parent f8c05b4 commit c11c3ea
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/vite-node/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,10 @@ export class ViteNodeRunner {
catch {
// old Node throws when invalid path
}
if (ok) {
(meta as any).resolve
= (specifier: string, parent?: string | URL) =>
import.meta.resolve(specifier, parent ?? href)
(meta as any).resolve = (specifier: string, parent?: string | URL) => {
if (!ok)
throw new Error('[vite-node] "--experimental-import-meta-resolve" is required to enable "import.meta.resolve"')
return import.meta.resolve(specifier, parent ?? href)
}
}

Expand Down

0 comments on commit c11c3ea

Please sign in to comment.