我有一个全新的 Laravel 安装。在使用编译文件时npm run dev VUE
出现文件错误
“您可能需要适当的加载程序来处理此文件类型,目前没有配置加载程序来处理此文件”
Laravel 版本:“^8.12”
包.json
"devDependencies": {
"axios": "^0.21",
"laravel-mix": "^6.0.6",
"lodash": "^4.17.19",
"vue": "^2.5.17",
"vue-loader": "^15.9.6",
"vue-template-compiler": "^2.6.10"
}
刀片文件
<div id="app">
<hello></hello>
</div>
<script src="{{mix('js/app.js')}}"></script>
应用程序.js
require('./bootstrap');
import Vue from 'vue'
Vue.component('hello', require('./hello.vue').default);
const app = new Vue({
el: '#app'
});
你好.vue
<template>
<div>
Hello World!
</div>
</template>
<script>
export default {
}
</script>
npm 运行开发
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>
| <div>
| Hello World!