Replies: 4 comments
-
|
When you use the Vite configuration directly from a Blade file, you should also replicate that configuration on the vite.config.js as the docs say. I see you have the manifest option set but you can send the whole file to compare and try to reproduce? |
Beta Was this translation helpful? Give feedback.
-
|
Of course, but nothing fancy in my vite.config.js : import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
build: {
manifest: 'custom-manifest.json',
},
plugins: [
laravel({
input: [
'resources/css/site.css', 'resources/js/app.js',
],
refresh: true,
}),
],
server: {
watch: {
ignored: [
'**/storage/framework/views/**',
],
},
},
}); |
Beta Was this translation helpful? Give feedback.
-
|
Ok I just checked this out and the problem is on your resources/js/app.js file. Just follow the documentation below and everything should be fine, I just tested on my side and it worked. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Laravel Version
12.49
PHP Version
8.4.13
Database Driver & Version
No response
Description
According to the doc https://laravel.com/docs/12.x/vite#advanced-customization
we can configure Vite directly from a layout file :
But actually, when rendering a blade page which use a layout (either throught @extend directive or blade component), the page blade content is "proccessed" before the content in the layout file ...
So ... for instance if set a custom HotFile, in the layout, and use a {{
Vite::asset('resources/images/whatever.svg') }}in the blade file... It will fail because the later is called sooner...The workaround is to set custom Vite options in a ServiceProvider ... But to me, the doc is misleading.
Steps To Reproduce
Configure Custom Vite Options in a layout file ie :
And in a blade view file :
(optionnaly : In your vite config file, configure the custom-manifest.json)
Beta Was this translation helpful? Give feedback.
All reactions