I've created 'test.js' file in 'resources/js/' and added console.log(first)
to it
In the welcome.blade.php I have something like that:
<body>
@vite(['resources/js/test.js'])
<script type='text/javascript'>
console.log(second)
</script>
</body>
What I expect is to execute those scipts in order from top to bottom, however it returns output:
second
first
I guess @vite(['resources/js/test.js'])
is executed asynchronously by default, but I want to change it.
Is there any better way to do this than to put all the internal JS in DOMContentLoaded?