I am creating my vue project with typescript via vite
, and I use vite-plugin-pages for my router.
I got type error when I import routes from ~pages
Below is my code in my router:
import { createRouter, createWebHistory } from "vue-router";
import routes from "~pages"; // got error here
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes,
});
export default router;
and error:
Add /// <reference types="vite-plugin-pages/client" />
in env.d.ts
It's mentioned in README .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.