Randy_Johnson's avatar

Unable to locate file in Vite manifest: resources/css/app.css.

I just uploaded my website to the server and I am getting this error.

Checking to see if the file is there, I can confirm it is.

0 likes
18 replies
gych's avatar

Try to import app.css directly in app.js

Then only input app.js in vite config and in app.blade

1 like
rajeshtva's avatar

@randy_johnson , how and where this error is coming. as i understand either you are trying to build your frontend code on server. in that case. i would suggest you to check the import path.

if you have already built and still are getting this error. then i think you should show how you are using your vite directives in app.blade.php file. my guess is that you are manually adding app.css either in your app.blade.php or have mentioned in vite.config.js.

1 like
Randy_Johnson's avatar

@rajeshtva the error is coming from app.blade.php where @vite is first hit. I checked the file location because I have known for git ignore to no push files but I found the file in its correct location. I have never had this problem before.

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

www.scamschools.com

A social media style website to warn others of potential scams which occurs working in foreign countries.

1 like
Randy_Johnson's avatar

what a f... I just deleted the line and its worked.

1 like
gych's avatar

@Randy_Johnson Strange... are you using laravel with blade and isn't this causing other issues now?

Did you try my first suggestion/reply for this issue?

1 like
Randy_Johnson's avatar

@gych Yes, there are no issues, I am running on hostinger, I build everything before deploy, and then push it to git then push it to server, since the server doesn't have node.

1 like
vincent15000's avatar

@Randy_Johnson

Yes, there are no issues, I am running on hostinger, I build everything before deploy, and then push it to git then push it to server, since the server doesn't have node.

On hostinger, is it a shared webhosting ? What is the structure of the folders ? Where do you have copied the app files ?

Randy_Johnson's avatar

@vincent15000

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(),
    ],
});

App, public_html. Public html is a soft link to app/public.

On telephone, apologies for bad edit

1 like
gych's avatar
gych
Best Answer
Level 29

@Randy_Johnson If you add resources/css/app.css with @vite(['resources/css/app.css','resources/js/app.js']) to your app.blade file you also have to add it to the input in your vite config.

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

@Randy_Johnson

you actually only needed to delete extra reference of app.css. i suspcted that you would have done that mistake. The correct line to include in the app.blade.php is

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

you are supposed to import your resources/css/app.css file inside your resources/js/app.js file & that would suffice.

1 like
vincent15000's avatar

If you don't declare the app.css file in the vite configuration file, you can't access it with the @vite() helper.

Here is the base configuration file for vite to use with blade. You have to adapt it for React.

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

But if you are using React, I recommend you to not use styles from Laravel, but only inside the React components. So you can remove the app.css file.

Please or to participate in this conversation.