-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.ts
53 lines (52 loc) · 1.33 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
import { join } from 'path'
import vue from '@vitejs/plugin-vue'
import visualizer from 'rollup-plugin-visualizer'
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'
import Components from 'unplugin-vue-components/vite'
import { defineConfig, splitVendorChunkPlugin } from 'vite'
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
console.log(`🚀 command: ${command}, mode: ${mode}\n`)
return {
base: './',
plugins: [
vue(),
splitVendorChunkPlugin(),
Components({
// Vue 组件自动按需导入
resolvers: [
AntDesignVueResolver({
resolveIcons: true,
}),
],
dts: command === 'build' ? 'src/components.d.ts' : false,
}),
visualizer({
open: false,
gzipSize: true,
brotliSize: true,
filename: './node_modules/.cache/visualizer/stats.html',
}),
],
resolve: {
alias: {
'@/': '/src/',
},
},
build: {
rollupOptions: {
input: {
main: join(__dirname, 'index.html'),
viewer: join(__dirname, 'viewer.html'),
modeler: join(__dirname, 'modeler.html'),
},
},
},
server: {
open: true,
host: '127.0.0.1',
port: 4173,
strictPort: true,
},
}
})