Commit 6d6e0a1bfef3a152d31776520e1445203d2ba3f4
1 parent
b54b7942
fix(build): fix build error
Showing
3 changed files
with
12 additions
and
12 deletions
src/views/sys/about/index.vue
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | name: 'AboutPage', | 26 | name: 'AboutPage', |
27 | components: { Description, PageWrapper }, | 27 | components: { Description, PageWrapper }, |
28 | setup() { | 28 | setup() { |
29 | - const { pkg, lastBuildTime } = window.__APP_INFO__; | 29 | + const { pkg, lastBuildTime } = __APP_INFO__; |
30 | 30 | ||
31 | const { dependencies, devDependencies, name, version } = pkg; | 31 | const { dependencies, devDependencies, name, version } = pkg; |
32 | 32 |
types/global.d.ts
@@ -7,19 +7,18 @@ import type { | @@ -7,19 +7,18 @@ import type { | ||
7 | } from 'vue'; | 7 | } from 'vue'; |
8 | 8 | ||
9 | declare global { | 9 | declare global { |
10 | + declare interface __APP_INFO__ { | ||
11 | + pkg: { | ||
12 | + name: string; | ||
13 | + version: string; | ||
14 | + dependencies: Recordable<string>; | ||
15 | + devDependencies: Recordable<string>; | ||
16 | + }; | ||
17 | + lastBuildTime: string; | ||
18 | + } | ||
10 | declare interface Window { | 19 | declare interface Window { |
11 | // Global vue app instance | 20 | // Global vue app instance |
12 | __APP__: App<Element>; | 21 | __APP__: App<Element>; |
13 | - | ||
14 | - __APP_INFO__: { | ||
15 | - pkg: { | ||
16 | - name: string; | ||
17 | - version: string; | ||
18 | - dependencies: Recordable<string>; | ||
19 | - devDependencies: Recordable<string>; | ||
20 | - }; | ||
21 | - lastBuildTime: string; | ||
22 | - }; | ||
23 | } | 22 | } |
24 | 23 | ||
25 | // vue | 24 | // vue |
vite.config.ts
@@ -12,8 +12,9 @@ import { OUTPUT_DIR } from './build/constant'; | @@ -12,8 +12,9 @@ import { OUTPUT_DIR } from './build/constant'; | ||
12 | import pkg from './package.json'; | 12 | import pkg from './package.json'; |
13 | import moment from 'moment'; | 13 | import moment from 'moment'; |
14 | 14 | ||
15 | +const { dependencies, devDependencies, name, version } = pkg; | ||
15 | const APP_INFO = { | 16 | const APP_INFO = { |
16 | - pkg, | 17 | + pkg: { dependencies, devDependencies, name, version }, |
17 | lastBuildTime: moment().format('YYYY-MM-DD HH:mm:ss'), | 18 | lastBuildTime: moment().format('YYYY-MM-DD HH:mm:ss'), |
18 | }; | 19 | }; |
19 | 20 |