Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

assanimed's avatar

Unable to locate file in Vite manifest: resources/js/Pages/Login.jsx

Hello everyone,

I built and App with Laravel Interia and React for every route I return a react page component as inertia states

and When I finished I tried to run npm run build

after that whever I try to access my routes I get an error like that

Unable to locate file in Vite manifest: resources/js/Pages/Login.jsx

can anyone here help

thanks in advance

0 likes
7 replies
aruszala's avatar

@assanimed verify that the file public/build/manifest.json exists in your project.

Also, post your vite.config.js file.

1 like
assanimed's avatar

Yes the Manifest does exists

and this the content fo package.json

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import react from '@vitejs/plugin-react';

export default defineConfig({
    plugins: [
        laravel({
            input: 'resources/js/app.jsx',
            refresh: true,
        }),
        react(),
    ],
});

aruszala's avatar

@assanimed try:

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import react from '@vitejs/plugin-react';
 
export default defineConfig({
    plugins: [
        laravel(['resources/js/app.jsx']),
        react(),
    ],
});

You will also need to include the additional @viteReactRefresh Blade directive alongside your existing @vite directive.

@viteReactRefresh
@vite('resources/js/app.jsx')

The @viteReactRefresh directive must be called before the @vite directive.

Take a look here: https://laravel.com/docs/10.x/vite#react

2 likes
assanimed's avatar

Mate, Many Thanks to you and your cooperation and kindness

I get it

all I need to do is to

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

@vite(['resources/js/app.jsx'])

remove the second argument and now the app reads the build assets

once again you were cooperative mate

2 likes

Please or to participate in this conversation.