Skip to content

Adding NuxtUI for Vue3 plugin to Vite config cause an error #43

Closed
@kamilcglr

Description

@kamilcglr

Package version

1.2.3

Context

Hello, a few weeks ago, the Nuxt team made the Nuxt UI v3 component library compatible with standalone Vue projects.

I've been looking for a solution to use it with Inertia and AdonisJS, but I get an unexpected error:

TypeError: The URL must be of scheme file

Describe the bug

Here's the procedure I followed:

After creating a fresh AdonisJS project with the Inertia and Vue 3 starter kit

# Vue without server-side rendering
npm init adonisjs@latest -- -K=inertia --adapter=vue --no-ssr

Then I followed this procedure to add NuxtUI to the project

  1. Install the package with the latest commit, as the release has not yet been made
npm install https://pkg.pr.new/@nuxt/ui@5a9511f
  1. Add the Nuxt UI Vite plugin in the vite.config.ts
import ui from '@nuxt/ui/vite'
import { defineConfig } from 'vite'
import { getDirname } from '@adonisjs/core/helpers'
import inertia from '@adonisjs/inertia/client'
import vue from '@vitejs/plugin-vue'
import adonisjs from '@adonisjs/vite/client'

export default defineConfig({
  plugins: [
    inertia({ ssr: { enabled: false } }),
    vue(),
    adonisjs({ entrypoints: ['inertia/app/app.ts'], reload: ['resources/views/**/*.edge'] }),
    ui(),
  ],

  resolve: {
    alias: {
      '~/': `${getDirname(import.meta.url)}/inertia/`,
    },
  },
})

Here I already have a problem: I can't launch the application.

failed to load config from /Users/kamil/Documents/projects/myproject/vite.config.ts
TypeError: The URL must be of scheme file

Here is the Replit to reproduce
https://replit.com/@kamilcaglarcont/Adonis-x-Inertia-x-Vue-3-x-Nuxt-UI?v=1

Additional context

  • I tried with node 18, 20 and 22.
  • There is no problem with the use of the library with a Vite et Vue project alone.
  • It seems to be a problem with Vite or AdonisJS, but the error is not very explicit.

Logs

[ info ] starting HTTP server...
Debugger attached.
failed to load config from /Users/kamil/Documents/projects/myproject/vite.config.ts

   TypeError: The URL must be of scheme file

No more logs even with DEBUG=vite:*

Reproduction repo

https://replit.com/@kamilcaglarcont/Adonis-x-Inertia-x-Vue-3-x-Nuxt-UI?v=1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions