fix(nuxt): import builder path as file url

This commit is contained in:
Daniel Roe 2023-03-14 14:24:00 +00:00
parent 01ee5bd7c5
commit a1691721d4

View File

@ -1,3 +1,4 @@
import { pathToFileURL } from 'node:url'
import chokidar from 'chokidar' import chokidar from 'chokidar'
import { isIgnored, tryResolveModule } from '@nuxt/kit' import { isIgnored, tryResolveModule } from '@nuxt/kit'
import { debounce } from 'perfect-debounce' import { debounce } from 'perfect-debounce'
@ -82,6 +83,6 @@ async function bundle (nuxt: Nuxt) {
async function loadBuilder (nuxt: Nuxt, builder: string) { async function loadBuilder (nuxt: Nuxt, builder: string) {
const builderPath = await tryResolveModule(builder, [nuxt.options.rootDir, import.meta.url]) const builderPath = await tryResolveModule(builder, [nuxt.options.rootDir, import.meta.url])
if (builderPath) { if (builderPath) {
return import(builderPath) return import(pathToFileURL(builderPath).href)
} }
} }