kafka-ui/kafka-ui-react-app/vite.config.ts
Hrant Abrahamyan eb03a12233
Format dates in a single place, Display build date instead of full commit hash in version info (#2590)
* message

* if tag contains -SNAPSHOT - display formatted timestamp

* create Time format context

* fix pull request commits

* change pull request commits

* add fetchTimeFormat function

* add fetchTimeFormat function

* chnage test run

* fix testing error

* covered global context with tests

* removed unused import statement

* fixed smell

* pull master

* fixed code smeils

* covered Version component, hooks with tests, fixed code review comments

* converted outdated to boolean

* remove tag condition from return
2022-09-28 14:23:16 +03:00

52 lines
1.2 KiB
TypeScript

import {
defineConfig,
loadEnv,
UserConfigExport,
splitVendorChunkPlugin,
} 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(), splitVendorChunkPlugin()],
server: {
port: 3000,
},
build: {
outDir: 'build',
},
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,
},
'/actuator/info': {
target: proxy,
changeOrigin: true,
secure: false,
},
},
},
};
}
return defaultConfig;
});