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

martinszeltins's avatar

How to use Vite with Laravel?

Vite is a project from Vue that makes Vue.js development extremely fast. It doesn't have a build step while developing. But I think that by default Laravel uses Mix.js? Is there a way to replace it with Vite?

0 likes
5 replies
Sinnbeck's avatar

Mix is for compiling vue (and css or other Javascript frameworks), so you can just choose not to use it.

It is completely optional

Sinnbeck's avatar

Seems that it requires an installation in a directory. Try installing it and then move over the files into your laravel project and see if it runs.

Be aware that you probably need to run it on a different address than laravel as it does not support php. So using api to communicate between the two

martinszeltins's avatar

@sinnbeck Perhaps maybe it would be better to separate them into 2 different apps (frontend and backend)

But then how would I get them to be under the same address?

For example the frontend Vue app to be under the address of:

https://www.myapp.com/

and backend (Laravel) could be here:

https://www.myapp.com/api/users/1
Sinnbeck's avatar

Well maybe that would be possible once you compile for production, if you can load the whole code via a blade view. But for development, it seems you need two different addresses

But there is hardly any information out regarding how it can be used yet, so I would suggest trying it out yourself

Please or to participate in this conversation.