kafka-ui/kafka-ui-react-app/vite.config.ts
Oleg Shur 96b00785b5
Upgrade redux (#2299)
* got rid of redux-thunk

* Bump redux

* Bump ace. Got rid of node-fetch

* Fix vite config
2022-07-19 16:18:28 +03:00

57 lines
1.3 KiB
TypeScript

import { defineConfig, loadEnv, UserConfigExport } from 'vite';
import react from '@vitejs/plugin-react';
import tsconfigPaths from 'vite-tsconfig-paths';
export default defineConfig(({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
const defaultConfig: UserConfigExport = {
plugins: [react(), tsconfigPaths()],
server: {
port: 3000,
},
build: {
outDir: 'build',
rollupOptions: {
output: {
manualChunks: {
vendor: [
'react',
'react-router-dom',
'react-dom',
'redux',
'react-redux',
'styled-components',
'react-ace',
],
},
},
},
},
define: {
'process.env.NODE_ENV': `"${mode}"`,
'process.env.VITE_TAG': `"${process.env.VITE_TAG}"`,
'process.env.VITE_COMMIT': `"${process.env.VITE_COMMIT}"`,
},
};
const proxy = process.env.VITE_DEV_PROXY;
if (mode === 'development' && proxy) {
return {
...defaultConfig,
server: {
...defaultConfig.server,
open: true,
proxy: {
'/api': {
target: proxy,
changeOrigin: true,
secure: false,
},
},
},
};
}
return defaultConfig;
});