2
  Module parse failed: Unexpected token (1:0)
  You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See :// webpack . js .org/concepts#loaders
  > <template>
  |     <div class="container">
  |         <div class="row justify-content-center">
   @ ./resources/js/Router.js 4:0-53 11:15-19
   @ ./resources/js/app.js
   @ multi ./resources/js/App.js ./resources/sass/app.scss

in APP require('./bootstrap');

window.Vue = require('vue');
import VueRouter from 'vue-router'
Vue.use(VueRouter)

import router from './Router'
 new Vue({
    el: '#app',
    router
});

in Router js

i importing the vue-router and vue

import Vue from 'vue' import VueRouter from 'vue-router' Vue.use(VueRouter)

import User from './components/ExampleComponent.Vue'

Vue.use(VueRouter);

const router = new VueRouter({
    mode:'history',
    routes:[

        { path:'/user', component: User, } ,
        { path:'/categories', component: categories, } ,
    ]
})
2
  • You instantiated the Vue import on the window object. and then you are assigning the router to Vue. have you tried window.Vue.use()? I am not sure if that is the issue though. Oct 1, 2020 at 19:14
  • @JustinDuncan yes it importing in app.js
    – acer 4oer
    Oct 1, 2020 at 19:21

1 Answer 1

2

I ran into this error too. In my own case, I ran into this error because I wanted to use tailwind v2.0.

I think it have something to do with Laravel Mix v6.0 or POSTCSS 8. Because Vue SFCs doesn't work with PostCSS 8-only plugins yet. Taken from (https://github.com/JeffreyWay/laravel-mix/issues/2625).

So in my own case, the steps I took are listed below.

  1. I uninstall the concerned packages npm uninstall tailwindcss postcss autoprefixer
  2. Then I installed them back with compatibility build npm install tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9

Check https://tailwindcss.com/docs/installation#post-css-7-compatibility-build

  1. I added "laravel-mix": "^5.0.1" to the package.json file to downgrade the laravel mix from v6.0 to v5.0.1.

  2. Then npm install

  3. Finally, npm run watch

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.