Ben Lin
2024-06-07 aa0bc81d06736cc1a1bd210dde61f57736585d43
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { defineApplicationConfig } from '@vben/vite-config';
import topLevelAwait from 'vite-plugin-top-level-await';
import vueSetupExtend from 'vite-plugin-vue-setup-extend';
 
// export default defineConfig({
//   plugins: [vue(), vueSetupExtend()],
// });
 
export default defineApplicationConfig({
  overrides: {
    optimizeDeps: {
      esbuildOptions: {
        target: 'esnext',
      },
      include: [
        'echarts/core',
        'echarts/charts',
        'echarts/components',
        'echarts/renderers',
        'qrcode',
        '@iconify/iconify',
        'ant-design-vue/es/locale/zh_CN',
        'ant-design-vue/es/locale/en_US',
      ],
    },
    server: {
      port: 3100,
      proxy: {
        '/basic-api': {
          target: 'http://localhost:9528',
          changeOrigin: true,
          ws: true,
          rewrite: (path) => path.replace(new RegExp(`^/basic-api`), ''),
          // only https
          // secure: false
        },
        '/upload': {
          target: 'http://localhost:3300/upload',
          changeOrigin: true,
          ws: true,
          rewrite: (path) => path.replace(new RegExp(`^/upload`), ''),
        },
      },
    },
    plugins: [
      topLevelAwait({
        promiseExportName: '__tla',
        promiseImportName: (i) => `__tla_${i}`,
      }),
      vueSetupExtend(),
    ],
    build: {
      target: 'esnext',
      rollupOptions: {
        output: {
          manualChunks: {
            echarts: ['echarts'],
          },
        },
      },
    },
  },
});