[Vuejs]-Vue 3 inertia not resolving components

0👍

Your resolve: name => resolving(name) is not looking for components in pages. You have to manual import each components in your views.

<template>
   <SomeComponent/>
</template>
<script setup>
import SomeComponent from '@/pages/some-component'
</script>

However if you want to automatize this process, you can use unplugin-vue-components. If you are using vite you have to modify vite.config.ts with:

import Components from 'unplugin-vue-components/vite'

export default defineConfig({
  plugins: [
    vue(),
    ...
    Components({ dts: true, dirs: [_path + "/views"], }),
  ]
})

Then you don’t need the import SomeComponent from '@/pages/some-component' anymore.

Leave a comment