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 skilled programmer with expertise in Vue.js/Nux.js for front-end development and PHP Laravel for back-end development. I excel in building APIs and services, and also have experience in web server setup & maintenance. My versatile skill set allows you to develop and maintain web applications effectively, from the user interface to the server-side functionality. I love coding with never ending learning attitude, thanks for visiting danya.dk