-
Notifications
You must be signed in to change notification settings - Fork 15
/
vite.config.ts
94 lines (93 loc) · 2.67 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import path from 'node:path'
import vue from '@vitejs/plugin-vue'
import jsx from '@vitejs/plugin-vue-jsx'
import { presetAttributify, presetIcons, presetUno } from 'unocss'
import Unocss from 'unocss/vite'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import { defineConfig } from 'vite'
import viteCompression from 'vite-plugin-compression'
import Markdown from 'vite-plugin-md'
import Pages from 'vite-plugin-pages'
import {
VxeTableResolve,
createStyleImportPlugin,
} from 'vite-plugin-style-import'
import sassDts from 'vite-plugin-sass-dts'
// https://vitejs.dev/config/
export default defineConfig({
base: '/ff14-overlay-vue/',
build: {
outDir: './dist',
// emptyOutDir: true, // 构建时清空outDir目录
rollupOptions: {
output: {
// chunkFileNames: "assets/js/[name].js",
// entryFileNames: "assets/js/[name].js",
// assetFileNames: "assets/[ext]/[name].[ext]",
manualChunks(id) {
if (id.includes('node_modules'))
return 'vendor'
},
},
},
chunkSizeWarningLimit: 2000,
// sourcemap: true,
// minify: "terser",
// terserOptions: {
// compress: {
// drop_console: true,
// drop_debugger: true,
// },
// },
},
plugins: [
vue({
include: [/\.vue$/, /\.md$/], // <--
}),
jsx(),
Markdown(),
Components({
resolvers: [ElementPlusResolver()],
deep: true,
dts: './src/types/components.d.ts',
directoryAsNamespace: true,
}),
AutoImport({
imports: ['vue', '@vueuse/core'],
dts: './src/types/auto-imports.d.ts',
resolvers: [ElementPlusResolver()],
eslintrc: {
enabled: true, // Default `false`
filepath: './.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json`
globalsPropValue: true, // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
},
}),
viteCompression({
// verbose: false,
// filter: /\.(js|mjs|json|css)$/,
// disable: false,
// threshold: 1025,
// algorithm: "gzip",
// ext: ".gz",
// deleteOriginFile: true,
}),
Unocss({
presets: [presetUno(), presetAttributify(), presetIcons()],
}),
Pages(),
createStyleImportPlugin({
resolves: [VxeTableResolve()],
}),
sassDts(),
],
define: {
__VUE_OPTIONS_API__: false,
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
})