The issue you're facing is that the Inertia component rendered from the home route is missing when you run the build command. This error occurs because the file is not added to the generated manifest file.
To fix this issue, you can try the following steps:
- Update your
vite.config.jsfile to include themanifestoption:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
export default defineConfig({
plugins: [
laravel({
input: 'resources/js/app.ts',
refresh: true
}),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
}),
],
build: {
manifest: true,
},
});
- Run the build command again:
npm run build
This should add the missing Inertia component to the generated manifest file.
If the issue persists, you can try the following additional steps:
- Update your
app.tsfile to import the missing Inertia component explicitly:
import './bootstrap';
import '../css/app.css';
import { createApp, h, DefineComponent } from 'vue';
import { createInertiaApp } from '@inertiajs/vue3';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import { ZiggyVue } from '../../vendor/tightenco/ziggy/dist/vue.m';
// Import the missing Inertia component explicitly
import Index from './Pages/Index.vue';
// ...
createInertiaApp({
// ...
resolve: (name) => {
if (name === 'Index') {
return Index;
}
return resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob<DefineComponent>('./Pages/**/*.vue'));
},
// ...
}).then(r => {});
By explicitly importing the missing Inertia component, you ensure that it is included in the build.
- Run the build command again:
npm run build
This should resolve the issue and include the missing Inertia component in the generated manifest file.
If the issue still persists, you may need to further investigate your project setup and configuration to identify any other potential causes.