您好,我使用 laravel & Vue js 我的作者项目它工作正常但是这个错误?

Hello I use laravel & Vue js i author project it working fine but this error?

  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

在APP中 require('./bootstrap');

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

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

在路由器 js 中

我正在导入 vue-router 和 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, } ,
    ]
})

我运行也进入这个错误。在我自己的例子中,我 运行 进入这个错误是因为我想使用 tailwind v2.0.

我认为它与 Laravel Mix v6.0 或 POSTCSS 8 有关。因为 Vue SFC 还不能与仅支持 PostCSS 8 的插件一起使用。摘自 (https://github.com/JeffreyWay/laravel-mix/issues/2625).

所以在我自己的情况下,我采取的步骤如下所列。

  1. 我卸载相关包npm uninstall tailwindcss postcss autoprefixer
  2. 然后我用兼容性版本安装了它们 npm install tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9

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

  1. 我将 "laravel-mix": "^5.0.1" 添加到 package.json 文件以将 laravel 混合从 v6.0 降级到 v5.0.1。

  2. 然后npm install

  3. 最后,npm run watch