-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathvite.config.ts
59 lines (57 loc) · 1.83 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
import { defineConfig, loadEnv } from 'vite';
import { createHtmlPlugin } from 'vite-plugin-html';
import path from 'path';
import tsconfigPaths from 'vite-tsconfig-paths';
import env from 'vite-plugin-environment';
import check from 'vite-plugin-checker';
import react from '@vitejs/plugin-react-swc';
export default ({ mode }) => {
const envVars = loadEnv(mode, process.cwd());
return defineConfig({
resolve: {
alias: {
'@config': path.resolve(__dirname, 'src/config'),
'@pages': path.resolve(__dirname, 'src/pages'),
'@layouts': path.resolve(__dirname, 'src/layouts'),
'@components': path.resolve(__dirname, 'src/components'),
'@translations': path.resolve(__dirname, 'src/translations'),
'@assets': path.resolve(__dirname, 'src/assets'),
'@styles': path.resolve(__dirname, 'src/styles'),
'@hooks': path.resolve(__dirname, 'src/hooks'),
'@store': path.resolve(__dirname, 'src/store'),
'@helpers': path.resolve(__dirname, 'src/helpers'),
},
},
plugins: [
react(),
tsconfigPaths(),
check({ typescript: true }),
env('all'),
createHtmlPlugin({
viteNext: true,
minify: true,
inject: {
data: {
title: envVars.VITE_APP_TITLE,
description: envVars.VITE_APP_DESCRIPTION,
heapId: envVars.VITE_HEAP_ID,
googleMapsApiKey: envVars.VITE_GOOGLE_MAPS_API_KEY,
},
},
}),
],
build: {
sourcemap: true,
},
optimizeDeps: {
// This is a temporary fix for the Grid2 issue
// https://github.com/mui/material-ui/issues/32727#issuecomment-1697253782
include: [
'@mui/material/Unstable_Grid2',
'@emotion/react',
'@emotion/styled',
'@mui/material/Tooltip',
],
},
});
};