forked from AIOS-club/aios.chat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
57 lines (55 loc) · 1.47 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
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
import AutoImport from 'unplugin-auto-import/vite';
import Pages from 'vite-plugin-pages';
import legacy from '@vitejs/plugin-legacy';
import svgLoader from '@andylacko/vite-svg-react-loader';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
return {
base: env.VITE_BASE_URL,
server: {
host: '0.0.0.0',
https: false,
port: 5173,
open: true,
},
build: {
minify: 'terser',
outDir: 'dist/client',
},
plugins: [
react(),
svgLoader(),
// https://github.com/hannoeru/vite-plugin-pages
Pages({
exclude: ['**/components/**/*'],
}),
// https://github.com/vitejs/vite/tree/main/packages/plugin-legacy
legacy({
targets: ['defaults', 'not IE 11'],
// polyfills: ['es.array.at', 'es.string.match-all'],
// modernPolyfills: [],
}),
// https://github.com/antfu/unplugin-auto-import
AutoImport({
imports: ['react', 'react-router-dom'],
dts: true,
}),
],
css: {
modules: {
scopeBehaviour: 'local',
generateScopedName: '[name]__[local]___[hash:base64:5]',
localsConvention: 'camelCaseOnly',
},
},
resolve: {
alias: {
'~/': `${resolve(__dirname, 'src')}/`,
'@': resolve(__dirname, 'src'),
},
},
}
});