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

vincent15000's avatar

The first loading of the website takes 20 seconds

Hello,

I'm using vite with the last version of Laravel. It's faster than webpack when I update my code, but there is a problem for the first loading of the website.

I type npm run dev in the console and vite is ready within 2 seconds.

Then I open the browser and I type the address localhost:8000 and it takes 20 seconds to load an empty page. Once this first loading of the website is done, all works fine.

Have you any idea why it takes so much time for the first loading ?

Thanks for your answer.

Vincent

0 likes
5 replies
Tray2's avatar

I suggest checking the devtools and the network tab to see which request takes time.

1 like
siangboon's avatar

try some debug tools such as debugbar or telescope, probably it can help to find out what causing it...

1 like
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

It is true that the vite server can take a bit to connect on the first connection, but 10 seconds sounds wild. On my own machine its 1-2 seconds on first connect

1 like
Sinnbeck's avatar

@vincent15000 That could be it then. It connects to the npm dev server, and injects all needed css and js and sets up the hot reload

Please or to participate in this conversation.