{"scripts": {"dev":"vite","build-only":"vite build","preview":"vite preview --port 4173","build":"run-p type-check build-only",/* new(组合)*/"type-check":"vue-tsc --noEmit"/* new */ },"dependencies": {"vue":"^3.2.38" },"devDependencies": {"@vitejs/plugin-vue":"^3.0.3","vite":"^3.0.9","@types/node":"^16.11.56",/* new */"@vue/tsconfig":"^0.1.3",/* new */"npm-run-all":"^4.1.5",/* new */"typescript":"~4.7.4",/* new */"vue-tsc":"^0.40.7"/* new */ }}
// 1. src/router/index.jsimport { createRouter, createWebHistory } from'vue-router'import HomeView from'../views/HomeView.vue'constrouter=createRouter({ history:createWebHistory(import.meta.env.BASE_URL), routes: [ { path:'/', name:'home', component: HomeView }, { path:'/about', name:'about',// route level code-splitting// this generates a separate chunk (About.[hash].js) for this route// which is lazy-loaded when the route is visited.component: () =>import('../views/AboutView.vue') } ]})exportdefault router