-
Notifications
You must be signed in to change notification settings - Fork 11
/
vite.config.js
64 lines (62 loc) · 2.16 KB
/
vite.config.js
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
import { defineConfig, loadEnv } from 'vite'
import path from 'path'
import pkg from './package.json'
import useCompressPlugin from './config/useCompressPlugin'
import useProgressPlugin from './config/useProgressPlugin'
import useVuePlugin from './config/useVuePlugin'
import useVisualizerPlugin from './config/useVisualizerPlugin'
import useServer from './config/useServer'
import useEslintPlugin from './config/useEslintPlugin'
export default ({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
return defineConfig({
base: env.VITE_PUBLIC_PATH,
build: {
outDir: env.VITE_OUT_DIR,
target: 'es2015',
cssTarget: 'chrome80',
brotliSize: false,
chunkSizeWarningLimit: 2000,
rollupOptions: {
output: {
manualChunks: {
tinymce: ['tinymce'],
echarts: ['echarts'],
'lodash-es': ['lodash-es'],
'ant-design-vue': ['ant-design-vue'],
jschardet: ['jschardet'],
qrcode: ['qrcode'],
cropper: ['cropperjs'],
},
},
},
},
css: {
preprocessorOptions: {
less: {
modifyVars: {
hack: `
true;
@import '${path.resolve(__dirname, 'src/styles/variables.less')}';
@import '${path.resolve(__dirname, 'src/styles/mixins/index.less')}';
`,
},
javascriptEnabled: true,
},
},
devSourcemap: true,
},
define: {
__APP_INFO__: JSON.stringify({
version: pkg.version,
}),
},
plugins: [useVuePlugin(), useProgressPlugin(), useCompressPlugin(), useVisualizerPlugin(), useEslintPlugin()],
server: useServer(),
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
})
}