meet/vite.config.ts
Kevin Szuchet 61aaaeeebc
feat: Add navbar (#5)
* feat: Add navbar

* chore: Open server when start app

* style: Css file styles and delete empty file
2023-08-15 17:25:10 +02:00

51 lines
1.6 KiB
TypeScript

import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill'
import react from '@vitejs/plugin-react-swc'
import rollupNodePolyFill from 'rollup-plugin-polyfill-node'
import { defineConfig, loadEnv } from 'vite'
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
const envVariables = loadEnv(mode, process.cwd())
return {
plugins: [react()],
// Required because the CatalystClient tries to access it
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,
optimizeDeps: {
esbuildOptions: {
// Node.js global to browser globalThis
define: {
global: 'globalThis'
},
// Enable esbuild polyfill plugins
plugins: [
NodeGlobalsPolyfillPlugin({
buffer: true,
process: true
}),
NodeModulesPolyfillPlugin()
]
}
},
build: {
commonjsOptions: {
transformMixedEsModules: true
},
rollupOptions: {
plugins: [rollupNodePolyFill()]
}
}
}
: { server: { open: true } })
}
})