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

lightyagami's avatar

Laravel error call to undefined function Vite::asset()

so, i'm reading the docs and following the instructions at this point: https://laravel.com/docs/9.x/vite#blade-processing-static-assets i'm trying to display the logo in my navbar by adding <img src="{{ Vite::asset('resources/imageslogo.png') }}"> but i get: Call to undefined method Illuminate\Foundation\Vite::asset() so i'm stuck at it now... re-read the doc again and i not seen any mention to Vite::asset(), only at this page... so when i run npm run build my images are versioned and go to public folder, so the Vite::asset() should be able to get the versioned image, but seems like this method not exists...

0 likes
2 replies
thinkverse's avatar
Level 15

The feature is not yet released, the docs for it were merged before the feature was released. Vite::asset should be available in the next release of Laravel, released on Tuesday, here's a quote from @timacdonald

Apologies that the documentation has been merged before release on this one - but you are correct that the feature has been merged but not yet tagged. You will be able to access this feature when Laravel is released on Tuesday.

Source: https://github.com/laravel/framework/issues/43764#issuecomment-1220067553

1 like

Please or to participate in this conversation.