Open 13075239117 opened 1 year ago
If you are using auto-import why line 9 exists?
1:08:04 [vite] Internal server error: Failed to resolve import "vant/es" from "src\pages\home\index.vue". Does the file exist? Plugin: vite:import-analysis File: D:/jokey/jokey-vue3-ts/src/pages/home/index.vue:9:38 7 | import { defineComponent as defineComponent } from "vue"; 8 | import { testStore } from "@/store/test"; 9 | import { Button as VanButton } from "vant/es";
If you are using auto-import why line 9 exists?
1:08:04 [vite] Internal server error: Failed to resolve import "vant/es" from "src\pages\home\index.vue". Does the file exist? Plugin: vite:import-analysis File: D:/jokey/jokey-vue3-ts/src/pages/home/index.vue:9:38 7 | import { defineComponent as defineComponent } from "vue"; 8 | import { testStore } from "@/store/test"; 9 | import { Button as VanButton } from "vant/es";
no ,I put up the wrong message yesterday ,please look at it again. I fixed it
vant/es/button/style/index
is a correct path.
Do you install vant correctly? Please check your node_module
我也遇到这个错了 新建的项目
vant/es/button/style/index
is a correct path. Do you install vant correctly? Please check your node_module
...It doesn't work . It only works if I do that. ... i don't know why
import { Button as VanButton, Popup as VanPopup } from "vant";
this is my package.json { "name": "jokey-vue3-ts", "private": true, "version": "0.0.1", "type": "module", "scripts": { "dev": "vite", "build": "vue-tsc --noEmit && vite build", "preview": "vite preview" }, "dependencies": { "amfe-flexible": "^2.2.1", "axios": "^1.2.0", "crypto-js": "^4.1.1", "path-to-regexp": "^6.2.1", "pinia": "^2.0.26", "qs": "^6.11.0", "urijs": "^1.19.11", "vant": "^4.0.0", "vconsole": "^3.15.0", "vue": "^3.2.37", "vue-router": "^4.1.6" }, "devDependencies": { "@types/node": "^18.11.5", "@vitejs/plugin-vue": "^3.1.0", "less": "^4.1.3", "less-loader": "^11.1.0", "postcss": "^8.4.19", "postcss-pxtorem": "^6.0.0", "typescript": "^4.6.4", "unplugin-auto-import": "^0.11.5", "unplugin-vue-components": "^0.22.11", "vite": "^3.1.0", "vite-plugin-pages": "^0.27.1", "vite-plugin-svg-icons": "^2.0.1", "vite-plugin-vue-images": "^0.6.1", "vite-plugin-vue-layouts": "^0.7.0", "vite-plugin-windicss": "^1.8.8", "vue-tsc": "^0.40.4", "windicss": "^3.5.6" } }
请问>
解决了吗
漏掉了 .mjs 后缀,所以找不到 vant 里的 .mjs 模块
09:18:01 [vite] Internal server error: Failed to resolve import "vant/es" from "src\pages\home\index.vue". Does the file exist? Plugin: vite:import-analysis File: D:/jokey/jokey-vue3-ts/src/pages/home/index.vue:2:90 1 |
2 | / unplugin-vue-components disabled /import { Button as unplugin_components_3 } from 'vant/es';import 'vant/es/button/style/index';
| ^ 3 | import unplugin_components_2 from 'D:/jokey/jokey-vue3-ts/src/components/SvgIcon/index.vue'; 4 | import __unplugin_components_1 from 'D:/jokey/jokey-vue3-ts/src/components/Test/ok/jojo.vue'; at formatError (file:///D:/jokey/jokey-vue3-ts/node_modules/_vite@3.2.4@vite/dist/node/chunks/dep-67e7f8ab.js:39975:46) at TransformContext.error (file:///D:/jokey/jokey-vue3-ts/node_modules/_vite@3.2.4@vite/dist/node/chunks/dep-67e7f8ab.js:39971:19) at normalizeUrl (file:///D:/jokey/jokey-vue3-ts/node_modules/_vite@3.2.4@vite/dist/node/chunks/dep-67e7f8ab.js:36839:33) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async TransformContext.transform (file:///D:/jokey/jokey-vue3-ts/node_modules/_vite@3.2.4@vite/dist/node/chunks/dep-67e7f8ab.js:36972:47) at async Object.transform (file:///D:/jokey/jokey-vue3-ts/node_modules/_vite@3.2.4@vite/dist/node/chunks/dep-67e7f8ab.js:40228:30) at async loadAndTransform (file:///D:/jokey/jokey-vue3-ts/node_modules/_vite@3.2.4@vite/dist/node/chunks/dep-67e7f8ab.js:36615:29)