@Speakermen

Почему возникает ошибка Module parse failed: Unexpected token?

Хотел использовать Vue в Laravel но npm ругается(

ERROR in ./resources/js/components/Posts/Index.vue 1:0
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 https://webpack.js.org/concepts#loaders
> <template>
|     <table class="table">
|         <thead>


require('./bootstrap');

import Vue from 'vue'

Vue.componenet('posts-index', require('./components/Posts/Index.vue').default)

const app = new Vue({
    'el': '#app'
});


<template>
    <table class="table">
        <thead>
            <tr>
                <th>Title</th>
                <th>Post text</th>
                <th>Created date</th>
                <th>Actions</th>
            </tr>
        </thead>
    </table>
</template>

<script>
    /*import { defineComponent } from '@vue/composition-api'

    export default defineComponent({
        setup() {
            
        },
    })*/
</script>


package.json

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "npm run production",
        "production": "mix --production"
    },
    "devDependencies": {
        "axios": "^0.21.1",
        "cross-env": "^7.0.3",
        "laravel-mix": "^6.0.12",
        "lodash": "^4.17.21",
        "postcss": "^8.2.8",
        "resolve-url-loader": "^3.1.2",
        "sass": "^1.20.1",
        "sass-loader": "^11.0.1",
        "vue": "^2.6.12",
        "vue-template-compiler": "^2.6.12"
    }
}


<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>Laravel</title>
    </head>
    <body>
        <div id="app">
            <posts-index></posts-index>
        </div>

        <script src="{{ asset('js/app.js') }}"></script>
    </body>
</html>
  • Вопрос задан
  • 392 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы