Show your vite config and the absolute path to the file
Jul 10, 2022
16
Level 63
Error when importing a component / layout
Hello,
I have an error when importing a component / layout.
import Layout from './Layout'
Here is the error.
/* unplugin-vue-components disabled */
...
[plugin:vite:import-analysis] Failed to resolve import "./Layout" from "resources/js/Pages/AboutComponent.vue". Does the file exist?
Vite seems not to resolve correctly the path to retrieve the component. But the problem is perhaps not with Vite, I really don't know.
I just began discovering InertiaJS and Vite, so I don't have any experience with these technologies.
I have tried this to solve the problem, but nothing works.
import Layout from '@/Layout'
import Layout from 'absolute_path_to_layout'
Can you help me please ?
Thanks a lot.
Vincent
Level 102
@vincent15000 maybe a vue thing. Try
import Layout from '../Layout.vue'
7 likes
Please or to participate in this conversation.