Skip to content

Commit

Permalink
fix(vite-node): make resolveId optional
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Mar 16, 2022
1 parent a8955bb commit aba4ea8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/vite-node/src/client.ts
Expand Up @@ -55,7 +55,7 @@ export class ViteNodeRunner {
const request = async(dep: string) => {
// probably means it was passed as variable
// and wasn't transformed by Vite
if (this.shouldResolveId(dep)) {
if (this.options.resolveId && this.shouldResolveId(dep)) {
const resolvedDep = await this.options.resolveId(dep, id)
dep = resolvedDep?.id?.replace(this.root, '') || dep
}
Expand Down
4 changes: 2 additions & 2 deletions packages/vite-node/src/types.ts
Expand Up @@ -38,9 +38,9 @@ export interface ModuleCache {
}

export interface ViteNodeRunnerOptions {
fetchModule: FetchFunction
resolveId: ResolveIdFunction
root: string
fetchModule: FetchFunction
resolveId?: ResolveIdFunction
base?: string
moduleCache?: Map<string, ModuleCache>
interopDefault?: boolean
Expand Down

0 comments on commit aba4ea8

Please sign in to comment.