Commit 6d6e0a1bfef3a152d31776520e1445203d2ba3f4

Authored by Vben
1 parent b54b7942

fix(build): fix build error

src/views/sys/about/index.vue
... ... @@ -26,7 +26,7 @@
26 26 name: 'AboutPage',
27 27 components: { Description, PageWrapper },
28 28 setup() {
29   - const { pkg, lastBuildTime } = window.__APP_INFO__;
  29 + const { pkg, lastBuildTime } = __APP_INFO__;
30 30  
31 31 const { dependencies, devDependencies, name, version } = pkg;
32 32  
... ...
types/global.d.ts
... ... @@ -7,19 +7,18 @@ import type {
7 7 } from 'vue';
8 8  
9 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 19 declare interface Window {
11 20 // Global vue app instance
12 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 24 // vue
... ...
vite.config.ts
... ... @@ -12,8 +12,9 @@ import { OUTPUT_DIR } from &#39;./build/constant&#39;;
12 12 import pkg from './package.json';
13 13 import moment from 'moment';
14 14  
  15 +const { dependencies, devDependencies, name, version } = pkg;
15 16 const APP_INFO = {
16   - pkg,
  17 + pkg: { dependencies, devDependencies, name, version },
17 18 lastBuildTime: moment().format('YYYY-MM-DD HH:mm:ss'),
18 19 };
19 20  
... ...