Skip to content

Commit df93b4c

Browse files
committed
chore: migrate vue-router
1 parent 381ac3a commit df93b4c

8 files changed

Lines changed: 137 additions & 88 deletions

File tree

.eslintcache

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

package-lock.json

Lines changed: 106 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@
3737
"typescript-eslint": "^8.55.0",
3838
"unplugin-imagemin": "^0.7.0",
3939
"unplugin-turbo-console": "^2.3.0",
40-
"unplugin-vue-router": "^0.19.2",
4140
"vite": "^7.3.1",
4241
"vite-plugin-vue-devtools": "^8.0.6",
4342
"vite-plugin-zip-pack": "^1.2.4",
4443
"vue": "^3.5.28",
4544
"vue-i18n": "^11.2.8",
46-
"vue-router": "^4.6.0",
45+
"vue-router": "^5.0.0",
4746
"vue-tsc": "^3.2.4",
4847
"web-ext": "^9.3.0",
4948
"webext-bridge": "^6.0.1",

src/components/state/DisplayError.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
</template>
1111

1212
<script setup lang="ts">
13-
import { defineProps } from "vue"
14-
1513
defineProps<{
1614
error: string
1715
}>()

src/types/typed-router.d.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
/* eslint-disable */
22
/* prettier-ignore */
3+
// oxfmt-ignore
34
// @ts-nocheck
45
// noinspection ES6UnusedImports
5-
// Generated by unplugin-vue-router. !! DO NOT MODIFY THIS FILE !!
6+
// Generated by vue-router. !! DO NOT MODIFY THIS FILE !!
67
// It's recommended to commit this file.
78
// Make sure to add this file to your tsconfig.json file as an "includes" or "files" entry.
89

9-
declare module 'vue-router/auto-resolver' {
10-
export type ParamParserCustom = never
10+
import type {
11+
RouteRecordInfo,
12+
ParamValue,
13+
ParamValueOneOrMore,
14+
ParamValueZeroOrMore,
15+
ParamValueZeroOrOne,
16+
} from 'vue-router'
17+
18+
declare module 'vue-router' {
19+
interface TypesConfig {
20+
ParamParsers: never
21+
}
1122
}
1223

1324
declare module 'vue-router/auto-routes' {
14-
import type {
15-
RouteRecordInfo,
16-
ParamValue,
17-
ParamValueOneOrMore,
18-
ParamValueZeroOrMore,
19-
ParamValueZeroOrOne,
20-
} from 'vue-router'
21-
2225
/**
23-
* Route name map generated by unplugin-vue-router
26+
* Route name map generated by vue-router
2427
*/
2528
export interface RouteNamedMap {
2629
'/action-popup/': RouteRecordInfo<
@@ -131,7 +134,7 @@ declare module 'vue-router/auto-routes' {
131134
}
132135

133136
/**
134-
* Route file to route info map by unplugin-vue-router.
137+
* Route file to route info map by vue-router.
135138
* Used by the \`sfc-typed-router\` Volar plugin to automatically type \`useRoute()\`.
136139
*
137140
* Each key is a file path relative to the project root with 2 properties:
@@ -244,3 +247,5 @@ declare module 'vue-router/auto-routes' {
244247
? Info['routes']
245248
: keyof RouteNamedMap
246249
}
250+
251+
export {}

src/types/vite-env.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/// <reference types="vite/client" />
2-
/// <reference types="unplugin-vue-router/client" />
32

43
// Put your variables here:
54

src/utils/router/index.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
import { createRouter, createWebHistory } from "vue-router"
1+
import { createRouter, createWebHashHistory } from "vue-router"
22
import { handleHotUpdate, routes } from "vue-router/auto-routes"
33

4-
routes.push({
5-
path: "/:catchAll(.*)*",
6-
redirect: "/",
7-
})
4+
const finalRoutes = [
5+
...routes,
6+
{
7+
path: "/:catchAll(.*)*",
8+
redirect: "/",
9+
},
10+
]
811

912
export const appRouter = createRouter({
10-
history: createWebHistory(import.meta.env.BASE_URL),
11-
routes,
13+
history: createWebHashHistory(),
14+
routes: finalRoutes,
1215
})
1316

1417
if (import.meta.hot) {

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { fileURLToPath } from "node:url"
33
import { defineConfig } from "vite"
44
import vue from "@vitejs/plugin-vue"
55
import vueDevTools from "vite-plugin-vue-devtools"
6-
import VueRouter from "unplugin-vue-router/vite"
6+
import VueRouter from "vue-router/vite"
77
import TurboConsole from "unplugin-turbo-console/vite"
88
import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite"
99
import ui from "@nuxt/ui/vite"

0 commit comments

Comments
 (0)