-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
46 lines (46 loc) · 1.08 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
/*
* @Author: 肖 学海 1379228273@qq.com
* @Date: 2022-12-27 09:05:59
* @LastEditors: 肖 学海 1379228273@qq.com
* @LastEditTime: 2023-04-02 14:51:01
* @Description:
*/
import { ConfigEnv, defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react-swc';
import { GlobEnvConfig } from '@/types/config';
import { vitePluginForArco } from '@arco-plugins/vite-react';
import legacy from '@vitejs/plugin-legacy';
// https://vitejs.dev/config/
export default ({ mode }: ConfigEnv) => {
const env = loadEnv(mode, process.cwd()) as unknown as GlobEnvConfig;
const base = env.VITE_BASE.endsWith('/')
? env.VITE_BASE
: `${env.VITE_BASE}/`;
return defineConfig({
base,
plugins: [
legacy({
targets: ['Chrome 64'],
modernPolyfills: true
}),
react(),
vitePluginForArco({
style: true
})
],
resolve: {
alias: [{ find: '@', replacement: '/src' }]
},
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true
}
}
},
server: {
host: '0.0.0.0',
port: 5300
}
});
};