From 416f96272a93687b030712f6bc63e7fc4f7d64c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20M=C3=A1ximiliano=2C=20Lo=20Giudice?= Date: Fri, 13 Dec 2024 18:38:21 -0300 Subject: [PATCH] fix: ERR_INVALID_URL_SCHEME in windows with vue plugin --- src/plugins/nuxt-environment.ts | 4 ++-- src/plugins/plugins.ts | 4 ++-- src/unplugin.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/nuxt-environment.ts b/src/plugins/nuxt-environment.ts index 240332a790..048830f175 100644 --- a/src/plugins/nuxt-environment.ts +++ b/src/plugins/nuxt-environment.ts @@ -1,5 +1,5 @@ import type { UnpluginOptions } from 'unplugin' -import { join, normalize } from 'pathe' +import { normalize } from 'pathe' import { resolvePathSync } from 'mlly' import MagicString from 'magic-string' @@ -9,7 +9,7 @@ import { runtimeDir } from '../unplugin' * This plugin normalises Nuxt environment (#imports) and `import.meta.client` within the Nuxt UI components. */ export default function NuxtEnvironmentPlugin() { - const stubPath = resolvePathSync(join(runtimeDir, 'vue/stubs'), { extensions: ['.ts', '.mjs', '.js'] }) + const stubPath = resolvePathSync('../runtime/vue/stubs', { extensions: ['.ts', '.mjs', '.js'], url: import.meta.url }) return { name: 'nuxt:ui', diff --git a/src/plugins/plugins.ts b/src/plugins/plugins.ts index 7db51d6b80..245c886fbd 100644 --- a/src/plugins/plugins.ts +++ b/src/plugins/plugins.ts @@ -15,9 +15,9 @@ import type { UnpluginOptions } from 'unplugin' export default function PluginsPlugin(options: NuxtUIOptions) { const plugins = globSync(['**/*', '!*.d.ts'], { cwd: join(runtimeDir, 'plugins'), absolute: true }) - plugins.unshift(resolvePathSync(join(runtimeDir, 'vue/plugins/head'), { extensions: ['.ts', '.mjs', '.js'] })) + plugins.unshift(resolvePathSync('../runtime/vue/plugins/head', { extensions: ['.ts', '.mjs', '.js'], url: import.meta.url })) if (options.colorMode) { - plugins.push(resolvePathSync(join(runtimeDir, 'vue/plugins/color-mode'), { extensions: ['.ts', '.mjs', '.js'] })) + plugins.push(resolvePathSync('../runtime/vue/plugins/color-mode', { extensions: ['.ts', '.mjs', '.js'], url: import.meta.url })) } return { diff --git a/src/unplugin.ts b/src/unplugin.ts index ad604351d4..e684df6dd3 100644 --- a/src/unplugin.ts +++ b/src/unplugin.ts @@ -1,6 +1,6 @@ import { fileURLToPath } from 'node:url' -import { join } from 'pathe' +import { join, normalize } from 'pathe' import { createUnplugin } from 'unplugin' import AutoImport from 'unplugin-auto-import' import { defu } from 'defu' @@ -41,7 +41,7 @@ export interface NuxtUIOptions extends Omit((_options = {}, meta) => { const options = defu(_options, { fonts: false, devtools: { enabled: false } }, defaultOptions)