Unable to locate file in Vite manifest: resources/css/filament/admin/theme.css on Production

I am facing vite manifest error on production while deploying using forge.
15 Replies
Dennis Koch
Dennis Koch2y ago
What does your vite.config.js look like? Did you run npm run build on production?
Dhruva
DhruvaOP2y ago
yes.. i run npm run build on production my site frontend is react.
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import react from '@vitejs/plugin-react';

export default defineConfig({
plugins: [
laravel({
input: [
'resources/css/filament/admin/theme.css',
'resources/css/app.css',
'resources/js/app.tsx',
],
ssr: 'resources/js/ssr.tsx',
refresh: true,
}),
react(),
],
});
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import react from '@vitejs/plugin-react';

export default defineConfig({
plugins: [
laravel({
input: [
'resources/css/filament/admin/theme.css',
'resources/css/app.css',
'resources/js/app.tsx',
],
ssr: 'resources/js/ssr.tsx',
refresh: true,
}),
react(),
],
});
Dennis Koch
Dennis Koch2y ago
Looks good to me.
Andrew Wallo
Andrew Wallo2y ago
Did you register it in the Panel configuration as well? In your Panel Service Provider using “->vitetheme()”?
Dennis Koch
Dennis Koch2y ago
That's what probably is causing the issue
Dhruva
DhruvaOP2y ago
yes i have put viteTheme in panel service
johncarter
johncarter2y ago
I can confirm I have the same issue, if I delete the viteTheme config from the PanelProvider then its all good. I can see that Dan has mentioned we should run composer install --no-scripts Not sure if that is the recommended way going forward or a temporary fix.
awcodes
awcodes2y ago
This is the recommended way. Unfortunately Vite throws an exception when it can’t find the file. Not a fan of it. Should only be a problem on first install
johncarter
johncarter2y ago
Typically just long enough to forget the fix.
awcodes
awcodes2y ago
After the first build any composer updates should be fine.
*
*2y ago
@awcodes can confirm I got my github action working again with --no-scripts What I had to do though looks quite nasty to me:
- name: Install Composer dependencies
run: composer install --no-scripts

- name: NPM Install
run: npm install

- name: NPM Build
run: npm run build
- name: Install Composer dependencies
run: composer install --no-scripts

- name: NPM Install
run: npm install

- name: NPM Build
run: npm run build
Does this constitute the recommended way? Or am I doing something unnecessary? I'd really love it if I could get away without the npm stuff, but looks like there's no other way.
Oddman
Oddman15mo ago
Confirming this also worked for me - commented out the viteTheme method call and my composer install worked fine. Hmmm, I can't seem to un-comment though without having that issue, so don't appear to be able to use a custom theme. Has this been reported as a bug?
awcodes
awcodes15mo ago
I want to say Dan fixed this. But even outside of filament laravel still throws an exception without building the assets. So I’m really not sure of the best solution. Like you can’t just run npm ci on GitHub because the filament preset won’t exist without composer install. So you can’t even really run it as a GitHub action without extra jobs. But then you’d also somehow have to make your deploy, ie through forge, to wait for that action to run first. So then you have to get into webhooks. It all seems overly complicated. I’ve gotten to the point of just building locally and not ignoring the builds. The merge conflicts are becoming easier to work with than the CI/CD.
*
*15mo ago
This is what I ended up doing as well.
Oddman
Oddman15mo ago
I don't have this problem outside of filament, though.

Did you find this page helpful?