-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.ts
64 lines (62 loc) · 1.67 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
64
import react from '@vitejs/plugin-react';
import { defineConfig, loadEnv } from 'vite';
import { createHtmlPlugin } from 'vite-plugin-html';
import viteTsconfigPaths from 'vite-tsconfig-paths';
const path = require('path');
export default ({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
return defineConfig({
build: {
// Relative to the root
outDir: '../build',
assetsDir: '',
rollupOptions: {
onwarn: (warning, warn) => {
if (warning.code === 'MODULE_LEVEL_DIRECTIVE') {
return;
}
warn(warning);
},
},
},
server: {
port: 3000,
proxy: {
'/proxy': {
target: 'https://dev.carp.dk',
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace(/^\/proxy/, ''),
headers: {
'ngrok-skip-browser-warning': '69420',
},
},
},
},
resolve: {
alias: {
'@Assets': path.resolve(__dirname, './src/assets'),
'@Components': path.resolve(__dirname, './src/components'),
'@Modules': path.resolve(__dirname, './src/components/modules'),
'@Utils': path.resolve(__dirname, './src/utils'),
},
},
plugins: [
react({
include: '**/*.{jsx,tsx}',
}),
createHtmlPlugin({
inject: {
data: {
title:
process.env.NODE_ENV === 'production'
? 'Copenhagen Research Platform'
: `🛠️ Copenhagen Research Platform`,
},
},
}),
viteTsconfigPaths(),
],
base: process.env.VITE_BASE_NAME,
});
};