Nov 9, 2022
0
Level 17
Vue and jQuery not found after upgrading to Laravel Mix 6
I was using laravel-mix-5 and everything worked perfectly. But now after upgrading to mix 6, I can see in the browser console an error that Vue nor found or $ is not a function.
Here what I've done so far
- Upgrade the mix to version 6 using:
npm install laravel-mix@latestcommand. - Updating vue-template to work with mix 6.
- I have this in my
webpack.mix.jsfile:
mix.js('resources/js/app.js', 'js/app.js')
.autoload({
jquery: ['$', 'window.jQuery', 'jQuery']
})
.vue({ version: 2 })
And here is my layout page:
<head>
<script src="{{ mix('js/app.js') }}"></script>
</head>
<body>
...
@stack('footer')
</html>
Here is my app.js file:
import Vue from 'vue'
window.Vue = Vue
import $ from 'jquery'
window.$ = window.jQuery = $
Vue.component('foo', require('foo').default)
Does anybody know what can be the problem?
Please or to participate in this conversation.