* chore: update dependencies and migrate to vue-router - Updated package versions in pnpm-workspace.yaml for build and dev dependencies. - Added migration note for vue-router in src/pages/README.md. - Created typed-router.d.ts for type definitions generated by vue-router. - Modified tsconfig.json to include typed-router.d.ts. - Updated vite.config.ts to use new vue-router imports and configured type definitions. * fix: type fix * fix: type fix * fix:resolve typescript error
71 lines
1.5 KiB
TypeScript
71 lines
1.5 KiB
TypeScript
/// <reference types="vitest" />
|
|
|
|
import path from 'node:path'
|
|
import Vue from '@vitejs/plugin-vue'
|
|
import UnoCSS from 'unocss/vite'
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
import Components from 'unplugin-vue-components/vite'
|
|
import VueMacros from 'unplugin-vue-macros/vite'
|
|
import { defineConfig } from 'vitest/config'
|
|
import { VueRouterAutoImports } from 'vue-router/unplugin'
|
|
import VueRouter from 'vue-router/vite'
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
'~/': `${path.resolve(__dirname, 'src')}/`,
|
|
},
|
|
},
|
|
plugins: [
|
|
// https://github.com/vuejs/router/pull/2603
|
|
VueRouter({
|
|
dts: 'src/typed-router.d.ts',
|
|
}),
|
|
|
|
VueMacros({
|
|
defineOptions: false,
|
|
defineModels: false,
|
|
plugins: {
|
|
vue: Vue({
|
|
script: {
|
|
propsDestructure: true,
|
|
defineModel: true,
|
|
},
|
|
}),
|
|
},
|
|
}),
|
|
|
|
// https://github.com/antfu/unplugin-auto-import
|
|
AutoImport({
|
|
imports: [
|
|
'vue',
|
|
'@vueuse/core',
|
|
VueRouterAutoImports,
|
|
{
|
|
// add any other imports you were relying on
|
|
'vue-router/auto': ['useLink'],
|
|
},
|
|
],
|
|
dts: true,
|
|
dirs: [
|
|
'./src/composables',
|
|
],
|
|
vueTemplate: true,
|
|
}),
|
|
|
|
// https://github.com/antfu/vite-plugin-components
|
|
Components({
|
|
dts: true,
|
|
}),
|
|
|
|
// https://github.com/antfu/unocss
|
|
// see uno.config.ts for config
|
|
UnoCSS(),
|
|
],
|
|
|
|
// https://github.com/vitest-dev/vitest
|
|
test: {
|
|
environment: 'jsdom',
|
|
},
|
|
})
|