-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathvite.config.ts
74 lines (65 loc) · 1.6 KB
/
vite.config.ts
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
64
65
66
67
68
69
70
71
72
73
74
import { visualizer } from 'rollup-plugin-visualizer'
import AutoImport from 'unplugin-auto-import/vite'
import { defineConfig, loadEnv } from 'vite'
import Checker from 'vite-plugin-checker'
import tsconfigPaths from 'vite-tsconfig-paths'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
export default ({ mode }) => {
const env = loadEnv(mode, process.cwd())
const { VITE_APP_PUBLIC_URL } = env
const isDev = mode === 'development'
return defineConfig({
plugins: [
vueJsx(),
vue(),
tsconfigPaths(),
visualizer({ open: false }),
AutoImport({
include: [
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
/\.vue\??/, // .vue
],
dts: './src/auto-import.d.ts',
imports: ['vue', 'pinia', '@vueuse/core'],
}),
Checker({
typescript: true,
enableBuild: true,
}),
],
resolve: {
alias: {
'node-fetch': 'isomorphic-fetch',
},
},
build: {
chunkSizeWarningLimit: 2500,
target: 'esnext',
// sourcemap: true,
rollupOptions: {
output: {
chunkFileNames: `js/[name]-[hash].js`,
entryFileNames: `js/[name]-[hash].js`,
},
},
},
optimizeDeps: {
exclude: [],
},
define: {
__DEV__: isDev,
__VUE_OPTIONS_API__: false,
},
base: !isDev ? VITE_APP_PUBLIC_URL || '' : '',
server: {
// https: true,
port: 9191,
},
esbuild: {
jsxFactory: 'h',
jsxInject: 'import {h,Fragment} from "vue"',
jsxFragment: 'Fragment',
},
})
}