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

prishmayo's avatar

Need help with using javascript libraries in blade files

I am using Laravel 9 which comes with Vite instead of Mix. I have imported a couple of javascript libraries in my laravel bootatrap.js file and i know you have to use "import" with Vite instead of "require" but i get a undefined function error in the browser console when using the libraries inside blade files, even though the function works in the console.

I read somewhere on the internet that Vite does not work with blade files. Is this true?

Is this even a problem with Vite or is it something else?

Any help is greatly appreciated. Thanks.

0 likes
2 replies
gych's avatar

Vite works with blade files, how are you using these libaries in the blade files? You might be doing something wrong.

Please or to participate in this conversation.