Skip to content

Commit

Permalink
fix: use resolver to resolve built-in providers
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jul 7, 2022
1 parent e5ca160 commit bb8381c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/provider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { normalize, resolve, dirname } from 'pathe'
import { resolvePath } from '@nuxt/kit'
import { createResolver, resolvePath } from '@nuxt/kit'
import * as fse from 'fs-extra'
import { hash } from 'ohash'
import type { InputProvider, ImageModuleProvider, ProviderSetup } from './types'
Expand Down Expand Up @@ -74,8 +74,9 @@ export async function resolveProvider (_nuxt: any, key: string, input: InputProv
input.provider = input.name
}

const resolver = createResolver(import.meta.url)
input.provider = BuiltInProviders.includes(input.provider)
? require.resolve('./runtime/providers/' + input.provider)
? await resolver.resolve('./runtime/providers/' + input.provider)
: await resolvePath(input.provider)

const setup = input.setup || providerSetup[input.name]
Expand Down

0 comments on commit bb8381c

Please sign in to comment.