-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
51 lines (47 loc) · 1.23 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
import { ConfigEnv, UserConfig } from 'vite';
import { resolve } from 'path';
import { createVitePlugins } from './config/vite/plugins';
import { generateModifyVars } from './config/themeConfig';
import { configManualChunk } from './config/vite/optimizer';
function pathResolve(dir: string) {
return resolve(process.cwd(), '.', dir);
}
// https://vitejs.dev/config/
export default ({ command, mode }: ConfigEnv): UserConfig => {
const isBuild = command === 'build';
const outDir = mode === 'build:doc' ? 'docs' : 'dist';
console.log(command, mode);
return {
base: '/lowcode-vue3/',
resolve: {
alias: [
// /@/xxxx => src/xxxx
{ find: /^~/, replacement: resolve(__dirname, '') },
{
find: /\/@\//,
replacement: pathResolve('src') + '/',
},
],
},
plugins: createVitePlugins(isBuild),
css: {
preprocessorOptions: {
less: {
modifyVars: generateModifyVars(),
javascriptEnabled: true,
},
},
},
build: {
target: 'es2015',
rollupOptions: {
output: {
manualChunks: configManualChunk,
},
},
brotliSize: false,
chunkSizeWarningLimit: 2000,
outDir,
}
}
}