-
Notifications
You must be signed in to change notification settings - Fork 4
/
vite.config.mjs
64 lines (63 loc) · 1.62 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
63
64
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
import path from 'path';
// https://vitejs.dev/config/
export default defineConfig({
base: '/',
build: {
chunkSizeWarningLimit: 4000,
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes('node_modules')) {
return 'vendor';
}
}
}
}
},
define: {
// Override __dirname in case a dependency (likely SUSHI or GoFSH) tries to use it
// see: https://main.vitejs.dev/config/shared-options.html#define
__dirname: '""',
// Override load variable -- for some reason, this variable is sometimes undefined when
// running the built code.
load: {}
},
plugins: [
react(),
nodePolyfills({
include: [
'child_process',
'constants',
'fs',
'http',
'https',
'net',
'os',
'path',
'stream',
'tls',
'util',
'zlib'
]
})
],
resolve: {
alias: {
// fhir/fhir is only used by SUSHI to convert XML so we don't need this
// and it takes up a lot of space in the production build
'fhir/fhir': path.resolve('./src/stubs/fhir.js'),
// avoid loading file system specific packages that we don't need
'fs-extra': path.resolve('./src/stubs/empty.js'),
'readline-sync': path.resolve('./src/stubs/empty.js'),
tar: path.resolve('./src/stubs/empty.js')
}
},
test: {
environment: 'jsdom',
globals: true,
setupFiles: 'tests/setupTests.js'
}
});