我创建了一个 Laravel 应用程序,然后使用 Laravel Breeze 添加了 Inertia 和 Vue。一切都运行良好,直到我写下以下内容:
import { Inertia } from '@inertia/inertia'
在我的AppName\\resources\\js\\Pages\\Dashboard.vue。然后,奇怪的是,当我在仪表板中打开浏览器时,我收到了以下 Vite 错误:
[插件:vite:导入分析] 无法解析从“resources\js\Pages\Dashboard.vue”导入“@inertia/inertia”。该文件存在吗?
这是我的package.json:
{
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"@inertiajs/vue3": "^1.0.0",
"@tailwindcss/forms": "^0.5.3",
"@vitejs/plugin-vue": "^4.0.0",
"autoprefixer": "^10.4.12",
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.2",
"lodash": "^4.17.19",
"postcss": "^8.4.18",
"tailwindcss": "^3.2.1",
"vite": "^4.0.0",
"vue": "^3.2.41"
},
"dependencies": {
"moment": "^2.29.4"
}
}
Run Code Online (Sandbox Code Playgroud)