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

slund's avatar
Level 5

Vite facade alias

Hello,

We have just upgraded from Webpack to Vite, but struggled a bit with using the Vite facade in the Blade files(https://laravel.com/docs/9.x/vite#working-with-blade-and-routes).

We had to add: 'View' => Illuminate\Support\Facades\View::class, to /website/config/app.php in order to get it to work.

I assume this is because we come from a Laravel version where all Laravel-native-facades were imported individually (therefore Vite not taken care of), whereas I think it's now handled by the Facade::defaultAliases() - however, if this is the case, then it could be awesome to have a hint about this in the documentation, for people with upgraded Laravel solutions (and Laravel beginners :-)).

Kind regards Søren

0 likes
2 replies
Sinnbeck's avatar

Actually I cannot find any docs regarding this. Weird. Anyways. Add this instead, to automatically load everything in the future

'aliases' => Facade::defaultAliases()->merge([
        // 'ExampleClass' => App\Example\ExampleClass::class,
    ])->toArray(),

https://github.com/laravel/laravel/blob/9.x/config/app.php#L211

It must have been forgotten in the upgrade docs for laravel 9. Might be a nice addition in a PR :)

1 like

Please or to participate in this conversation.