I want to know how the js files are rendered in my views ’cause i have a problem when i want to use Swal.fire i just receive an error.
Okay, first thanks to read this post, let me explain the problem, i’m beginner using blade files so i have the next code in the file app.js
import './bootstrap';
import Swal from 'sweetalert2'
In my blade layout i calling it like this
@vite('resources/js/app.js')
and now i want to use that instance of sweetalert in my views so i added the next code in the blade layout to
@yield('scripts')
But when i want to use Swal.fire()
The nex code is in a view filling the yield script
<script>
Swal.fire("Hi world");
</script>
i get the next error
Error that i receive when i want to use it
So i don’t know what i’m getting that error i think the order of my scripts are correct 🙁
Jonathan JV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.