generated from IamDavidev/Template-React-CleanCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
63 lines (59 loc) · 1.78 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 react from '@vitejs/plugin-react';
import * as path from 'path';
import { loadEnv, defineConfig as vitedefineConfig } from 'vite';
// import { defineConfig, UserConfigExport } from 'vitest/config';
export default ({ mode }: { mode: string }): any => {
return vitedefineConfig({
plugins: [react()],
resolve: {
alias: {
'~components': path.resolve(__dirname, './src/components'),
'~interfaces': path.resolve(__dirname, './src/interfaces'),
'~lib': path.resolve(__dirname, './src/lib'),
'~constants': path.resolve(__dirname, './src/constants'),
'~pages': path.resolve(__dirname, './src/pages'),
'@': path.resolve(__dirname, './src'),
},
},
define: { 'process.env': { ...loadEnv(mode, process.cwd()) } },
server: {
proxy: {
'^/assets': {
target: 'http://localhost:3000/',
},
},
},
});
};
/**
* config for tests : in production break for error in pluginOption[] only use when run test
*/
// export default ({ mode }: { mode: string }): UserConfigExport => {
// return defineConfig({
// plugins: [react()],
// test: {
// globals: true,
// environment: 'jsdom',
// setupFiles: './src/config/setup.config.ts',
// css: true,
// },
// resolve: {
// alias: {
// '~components': path.resolve(__dirname, './src/components'),
// '~interfaces': path.resolve(__dirname, './src/interfaces'),
// '~lib': path.resolve(__dirname, './src/lib'),
// '~constants': path.resolve(__dirname, './src/constants'),
// '~pages': path.resolve(__dirname, './src/pages'),
// '@': path.resolve(__dirname, './src'),
// },
// },
// define: { 'process.env': { ...loadEnv(mode, process.cwd()) } },
// server: {
// proxy: {
// '^/assets': {
// target: 'http://localhost:3000/',
// },
// },
// },
// });
// };