-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
33 lines (32 loc) · 979 Bytes
/
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
import react from '@vitejs/plugin-react-swc'
import { defineConfig, loadEnv } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
const envVariables = loadEnv(mode, process.cwd())
return {
plugins: [
react(),
// The catalyst client requires node polyfills to work in the browser.
nodePolyfills()
],
define: {
// eslint-disable-next-line @typescript-eslint/naming-convention
'process.env': {
// eslint-disable-next-line @typescript-eslint/naming-convention
VITE_REACT_APP_DCL_DEFAULT_ENV: envVariables.VITE_REACT_APP_DCL_DEFAULT_ENV
}
},
...(command === 'build'
? {
base: envVariables.VITE_BASE_URL,
build: {
commonjsOptions: {
transformMixedEsModules: true
},
sourcemap: true
}
}
: undefined)
}
})