From 9340e2556868c5416d86ed899798f071123fc782 Mon Sep 17 00:00:00 2001 From: Akirami <66513481+A-kirami@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:59:42 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=97=EF=B8=8F=20=E6=9B=B4=E6=8D=A2?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E7=B3=BB=E7=BB=9F=E4=BB=A5=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=20HMR=20(#209)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- pnpm-lock.yaml | 23 +++++++++-------------- src/router/index.ts | 2 +- tsconfig.json | 2 +- vite.config.ts | 6 ++---- 5 files changed, 14 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 696fee6e..bda142af 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "unplugin-vue-router": "^0.10.8", "vite": "^5.4.11", "vite-plugin-vue-devtools": "^7.6.7", - "vite-plugin-vue-layouts": "^0.11.0", + "vite-plugin-vue-meta-layouts": "^0.5.1", "vitest": "^2.1.6", "vue-eslint-parser": "^9.4.3", "vue-tsc": "^2.1.10" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7f7f25d2..70e35cf4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -273,9 +273,9 @@ importers: vite-plugin-vue-devtools: specifier: ^7.6.7 version: 7.6.7(@nuxt/kit@3.14.1592(magicast@0.3.5)(rollup@4.28.0))(rollup@4.28.0)(vite@5.4.11(@types/node@22.10.1))(vue@3.5.13(typescript@5.6.3)) - vite-plugin-vue-layouts: - specifier: ^0.11.0 - version: 0.11.0(vite@5.4.11(@types/node@22.10.1))(vue-router@4.5.0(vue@3.5.13(typescript@5.6.3)))(vue@3.5.13(typescript@5.6.3)) + vite-plugin-vue-meta-layouts: + specifier: ^0.5.1 + version: 0.5.1(vite@5.4.11(@types/node@22.10.1))(vue-router@4.5.0(vue@3.5.13(typescript@5.6.3))) vitest: specifier: ^2.1.6 version: 2.1.6(@types/node@22.10.1)(@vitest/ui@2.1.6)(happy-dom@15.11.7) @@ -4362,12 +4362,11 @@ packages: peerDependencies: vite: ^3.0.0-0 || ^4.0.0-0 || ^5.0.0-0 || ^6.0.0-0 - vite-plugin-vue-layouts@0.11.0: - resolution: {integrity: sha512-uh6NW7lt+aOXujK4eHfiNbeo55K9OTuB7fnv+5RVc4OBn/cZull6ThXdYH03JzKanUfgt6QZ37NbbtJ0og59qw==} + vite-plugin-vue-meta-layouts@0.5.1: + resolution: {integrity: sha512-iqy11j2oBIflxwBh4CCqbK3jl03hXO4RYYuj5/IvIe4m86zy7v2xwLOpyGZwP4RVRtJJTkXIiqTKQhR81ucVsg==} peerDependencies: - vite: ^4.0.0 || ^5.0.0 - vue: ^3.2.4 - vue-router: ^4.0.11 + vite: '>=2.0.0' + vue-router: '>=4.0.14' vite@5.4.11: resolution: {integrity: sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==} @@ -9356,15 +9355,11 @@ snapshots: transitivePeerDependencies: - supports-color - vite-plugin-vue-layouts@0.11.0(vite@5.4.11(@types/node@22.10.1))(vue-router@4.5.0(vue@3.5.13(typescript@5.6.3)))(vue@3.5.13(typescript@5.6.3)): + vite-plugin-vue-meta-layouts@0.5.1(vite@5.4.11(@types/node@22.10.1))(vue-router@4.5.0(vue@3.5.13(typescript@5.6.3))): dependencies: - debug: 4.3.7 - fast-glob: 3.3.2 + local-pkg: 0.5.1 vite: 5.4.11(@types/node@22.10.1) - vue: 3.5.13(typescript@5.6.3) vue-router: 4.5.0(vue@3.5.13(typescript@5.6.3)) - transitivePeerDependencies: - - supports-color vite@5.4.11(@types/node@22.10.1): dependencies: diff --git a/src/router/index.ts b/src/router/index.ts index 2a4e2140..fd947356 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,4 +1,4 @@ -import { setupLayouts } from 'virtual:generated-layouts' +import { setupLayouts } from 'virtual:meta-layouts' import { createRouter, createWebHistory } from 'vue-router' import { routes } from 'vue-router/auto-routes' diff --git a/tsconfig.json b/tsconfig.json index 77f40648..977ea2f3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -33,7 +33,7 @@ "types": [ "vite/client", "vitest/globals", - "vite-plugin-vue-layouts/client", + "vite-plugin-vue-meta-layouts/client", "unplugin-vue-macros/macros-global", "unplugin-vue-router/client", "unplugin-info/client" diff --git a/vite.config.ts b/vite.config.ts index 4c4dc759..ae7bfba5 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -14,7 +14,7 @@ import { VueRouterAutoImports } from 'unplugin-vue-router' import VueRouter from 'unplugin-vue-router/vite' import { defineConfig } from 'vite' import VueDevTools from 'vite-plugin-vue-devtools' -import Layouts from 'vite-plugin-vue-layouts' +import MetaLayouts from 'vite-plugin-vue-meta-layouts' import type { UserConfig } from 'vite' @@ -34,9 +34,7 @@ export default defineConfig({ }, betterDefine: false, }), - Layouts({ - pagesDirs: 'src/views', - }), + MetaLayouts(), AutoImport({ imports: [ 'vue',