-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
72 lines (68 loc) · 2.47 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
65
66
67
68
69
70
71
72
import reactPlugin from '@vitejs/plugin-react';
import path from 'path';
import { defineConfig, loadEnv, ProxyOptions, splitVendorChunkPlugin } from 'vite';
import checkerPlugin from 'vite-plugin-checker';
import svgrPlugin from 'vite-plugin-svgr';
// const proxyToDev: ProxyOptions = {
// changeOrigin: true,
// target: 'https://rekrutteringsbistand.intern.dev.nav.no/',
// cookieDomainRewrite: {
// 'localhost:3000': 'rekrutteringsbistand.intern.dev.nav.no/',
// },
// secure: false,
// };
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
return {
build: {
target: 'es2022',
sourcemap: true,
chunkSizeWarningLimit: 3000,
},
plugins: [
reactPlugin(),
svgrPlugin({
include: ['**/*.svg'],
exclude: '',
}),
checkerPlugin({
typescript: true,
eslint: {
lintCommand: 'eslint "./{src,mock}/**/*.{ts,tsx,js,jsx}"',
},
}),
// Splitt node_modules til en egen chunk.
// Dette fikser noen sirkulære avhengigheter i @ds/react.
splitVendorChunkPlugin(),
],
server: {
port: 3000,
proxy: {
'/stillingssok-proxy': {
changeOrigin: true,
target: `${env.STILLING_ES_URI}`,
rewrite: (path) => path.replace('/stillingssok-proxy', ''),
auth: `${env.STILLING_ES_USERNAME}:${env.STILLING_ES_PASSWORD}`,
},
// '/meg': proxyToDev,
// '/arbeidsgiver-notifikasjon-api': proxyToDev,
// '/modiacontextholder': proxyToDev,
// '/statistikk-api': proxyToDev,
// '/stillingssok-proxy': proxyToDev,
// '/stilling-api': proxyToDev,
// '/kandidat-api': proxyToDev,
// '/kandidatsok-api': proxyToDev,
// '/kandidatvarsel-api': proxyToDev,
// '/foresporsel-om-deling-av-cv-api': proxyToDev,
// '/synlighet-api': proxyToDev,
// '/presenterte-kandidater-api': proxyToDev,
// '/kandidatsok-proxy': proxyToDev,
},
},
resolve: {
alias: {
felles: path.resolve(__dirname, './src/felles'),
},
},
};
});