laravel_blog_image

Laravel Mix & Vue : Module parse failed: Unexpected token

I was trying to use Vue with Laravel 8 while running running npm run dev, encountered following error. 

package.json
 "laravel-mix": "^6.0.10",
 "vue-loader": "^15.9.6",
 "vue-template-compiler": "^2.6.12",
 "vue": "^2.6.12"

To resolve this issue, I updated webpack.mix.js & app.js with following.

webpack.mix.js
mix.js('resources/js/app.js', 'public/js').vue({ version: 2 });
app.js
window.Vue = require('vue').default;

These changes should resolve the problem.

Author: Danyal
I'm working as programmer since 2002. Born, grew up, studied and worked in Pakistan now Im located in Denmark since 2006.