我正在尝试使用 Vite 附带的 Laravel 9.1 构建一个 Web 应用程序,我个人以前从未使用过 Vite,所以我不太确定这个错误。
我似乎收到错误
TypeError: laravel is not a function
Run Code Online (Sandbox Code Playgroud)
每当我运行 npm run dev 时。运行构建时出现同样的错误。
下面我将发布我的 package.json 和 vite.config.js 文件。
包.json
{
"type": "module",
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"@vitejs/plugin-vue": "^2.3.3",
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.1",
"lodash": "^4.17.19",
"postcss": "^8.1.14",
"vite": "^3.2.4"
},
"dependencies": {
"got": "^11.8.3",
"vue": "^3.2.36",
"vue-loader": "^17.0.1"
}
}
Run Code Online (Sandbox Code Playgroud)
vite.config.js
import laravel from 'laravel-vite-plugin'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite' …Run Code Online (Sandbox Code Playgroud)