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
@assanimed did you run npm run dev or npm run build.
HEY @aruszala,
Yes I did as I said after Build the assets I run into this problem
@assanimed verify that the file public/build/manifest.json exists in your project.
Also, post your vite.config.js file.
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(),
],
});
@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
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
@assanimed Do you mind explaining why it works when we remove it?
Please or to participate in this conversation.