laravelvue.jsviteinertiajs

Unable to locate file in Vite manifest: resources/js/Pages/MainPage.vue


I'm using Laravel + Inertia + VueJS + Vite.

I did some research and it seems many people have different variations of this error, but none of the answers seem convincing enough or apply to my problem.

The error :

Unable to locate file in Vite manifest: resources/js/Pages/MainPage.vue.

Preface :

As with other people, everything works correctly and as expected when running npm run dev, but after building the files for production using npm run build, the error occurs.

Code :

In the head of my app.blade.php :

@routes
@vite(['resources/js/app.ts', "resources/js/Pages/{$page['component']}.vue"])
@inertiaHead

Details :

If you need any more details, feel free to ask.

What I tried :


Solution

  • I don't know if this qualifies as an answer but after a few months of ignoring the problem until I no longer could, I resolved it by using the following hacky and desperate method :

    Now here comes the hacky part to preserve git history from the old project :

    Like I said, this isn't a real 'solution', but it got my project working in the end and that's what ultimately matters so I'm putting it here in case it helps anyone who comes across this thread.

    Fair warning though, this will probably take a full day of work to do correctly...