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

cjholowatyj's avatar

axios not loading before laravel-precognition?

I keep getting this error in the console in my Laravel 10 +Octane +Precognition/Vue3/Vite/Inertia +SSR project:

Uncaught ReferenceError: Cannot access 'axios' before initialization

From what I can tell, laravel-precognition is trying to access axios but it isn't initialized yet... this is despite axios being attached to the window object in my bootstrap file...

When I run the vite dev server the error goes away and my project loads properly as expected. When I stop the vite dev server the error returns?!?!?! (And this error also occurs expectedly in production, where there is not vite server)

Please help!!!!!!!

0 likes
1 reply
aleahy's avatar

Have you done a production build so that the assets are there when you don't have the dev server running? npm run build

Please or to participate in this conversation.