laravel / vite-plugin

Laravel plugin for Vite.
MIT License
790 stars 148 forks source link

Delay when opening the first page for the first time #282

Closed erycson-cubo closed 7 months ago

erycson-cubo commented 7 months ago

Vite Plugin Version

v1.0.1

Laravel Version

v10.24.0

Node Version

v21.5.0

NPM Version

10.2.4

Operating System

Windows (WSL)

OS Version

11

Web browser and version

Google Chrome Version 120.0.6099.227 (Official build) 64 bits

Running in Sail?

No

Description

I develop using Laravel which runs on Docker, but runs Vite outside of Docker, what is happening is that, when opening the website for the first time (any page), there is a huge delay (up to 10 minutes) for me to receive the assets from the "yarn dev" server. This is getting worse every day, because I've always done it this way but now I practically have to run "yarn dev" and go out and do something. Remembering that the Vite server runs quickly. The project is not big, it has around 50 assets (JS, CSS and images)

Some images to demonstrate what I'm talking about

Time to start Vite vite-1

Time for Vite to respond to requests in the browser vite-2

It's not just SASS that is slow, all images and javascripts are slow

Steps To Reproduce

I don't know what is causing the slowdown, so I don't yet know how to replicate the problem

driesvints commented 7 months ago

Hi there. While I understand that this is annoying for you I do consider this an edge case at best. I recommend to not run Vite outside of Docker and to run it alongside the same image as your Laravel app. Something like Sail can help you with that.

If you still want to go ahead and figure out why this is running slow for you I recommend a support channel:

erycson-cubo commented 7 months ago

Vite runs outside of Docker, both vendor and node_modules are outside too