我有一个全新的 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!
原文由 Fredericka Hartman 发布,翻译遵循 CC BY-SA 4.0 许可协议
当您使用
laravel-mix 6
它对 webpack.mix.js 有不同的配置webpack.mix.js
使用
.vue()
参考链接 https://laravel-mix.com/docs/6.0/upgrade