-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.mjs
62 lines (60 loc) · 1.37 KB
/
vite.config.mjs
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
import react from '@vitejs/plugin-react';
import eslint from 'vite-plugin-eslint';
import svgrPlugin from 'vite-plugin-svgr';
import { checker } from 'vite-plugin-checker';
import { defineConfig, loadEnv } from 'vite';
// https://vitejs.dev/config/
export default ({ mode }) => {
Object.assign(process.env, loadEnv(mode, process.cwd()));
const basePath = process.env.VITE_URL_BASE_PATH;
return defineConfig({
base: basePath === '' ? '/' : basePath,
plugins: [
react(),
eslint(),
svgrPlugin(),
checker({
eslint: {
lintCommand: 'eslint "./src/**/*.{js,jsx,ts,tsx}"',
},
overlay: {
initialIsOpen: false,
position: 'br',
},
}),
],
css: {
devSourcemap: false,
preprocessorOptions: {
scss: {
api: 'modern-compiler', // or "modern"
},
},
},
build: {
outDir: 'build',
sourcemap: true,
},
server: {
open: true,
port: 3000,
},
optimizeDeps: {
esbuildOptions: {
define: {
global: 'globalThis',
},
},
},
resolve: {
alias: {
'@src': '/src',
'@components': '/src/app-components',
'@pages': '/src/app-pages',
'@styles': '/src/css',
'@common': '/src/common',
'@hooks': '/src/customHooks',
},
},
});
};