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

cjholowatyj's avatar

Cannot access axios before initialization?

My build stack: Laravel 10 +Octane +Precognition/Vue3/Vite/Inertia +SSR Trying to figure out how to mitigate the use of axios from within laravel-precognition without breaking my application... When running the vite dev server, my app loads and works 100% properly, but when I access my app without the vite server running (like in production for example), I get the following error (coming from within the laravel precognition source code after it's bundled into my app):

let axiosClient = axios.create();
                  ^
ReferenceError: Cannot access 'axios' before initialization
0 likes
0 replies

Please or to participate in this conversation.