-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathvite.config.ts
63 lines (61 loc) · 1.61 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
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
import Pages from 'vite-plugin-pages';
import legacy from '@vitejs/plugin-legacy';
import { VitePWA } from 'vite-plugin-pwa';
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: [],
}),
VitePWA({
registerType: 'autoUpdate',
injectRegister: 'auto',
manifest: {
name: 'aios.chat',
short_name: 'aois.chat',
icons: [
{ src: '/logo.svg', sizes: '192x192', type: 'image/svg+xml' },
],
},
})
],
css: {
modules: {
scopeBehaviour: 'local',
generateScopedName: '[name]__[local]___[hash:base64:5]',
localsConvention: 'camelCaseOnly',
},
},
resolve: {
alias: {
'~/': `${resolve(__dirname, 'src')}/`,
'@': resolve(__dirname, 'src'),
},
},
}
});