Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"You may need an appropiate loader to handle this file type" webpack and vue

Tags:

webpack

vue.js

I'm trying to compile webpack with the command:

node_modules/.bin/webpack

and i get the error:

Module parse failed: 
/home/vagrant/Code/stream/resources/assets/js/views/Contact.vue 
Unexpected token (1:0)
You may need an appropriate loader to handle this file type.

webpack show the error in each file with extension .vue

my routes looks like this

import VueRouter from 'vue-router';

let routes = [
{
    path: '/',
    component: require('./views/Home')
},

{
    path: '/about',
    component: require('./views/Test')
},

{
    path: '/contact',
    component: require('./views/Contact')
}
];

export default new VueRouter({
routes,
linkActiveClass: 'is-active'
});
like image 268
Lluís Puig Ferrer Avatar asked Jul 11 '17 10:07

Lluís Puig Ferrer


1 Answers

Make sure you don't use keywords like "package" or others. This gave me the same error when using the PUG preprocessor, but at first I didn't know I was using the keyword. I replaced it with "item": v-for="package in packages" --> v-for="item in packages".

.table__wrapper

    .table__row(v-for="package in packages" :key="package.objectID")

        .table__row-name {{ package.name }}
like image 182
mark nikolsky Avatar answered Nov 10 '22 10:11

mark nikolsky