2022-09-16 17:18:15 +00:00
|
|
|
import { defineConfig } from 'vite';
|
|
|
|
import react from '@vitejs/plugin-react';
|
|
|
|
import eslint from 'vite-plugin-eslint';
|
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
|
|
const common = {
|
2022-10-20 12:17:34 +00:00
|
|
|
base: '',
|
2022-09-16 17:18:15 +00:00
|
|
|
plugins: [react(), eslint()],
|
|
|
|
server: {
|
2022-09-29 05:34:11 +00:00
|
|
|
// Proxy HTTP requests to the flask server
|
2022-09-16 17:18:15 +00:00
|
|
|
proxy: {
|
|
|
|
'/outputs': {
|
2022-09-29 05:34:11 +00:00
|
|
|
target: 'http://127.0.0.1:9090/outputs',
|
2022-09-16 17:18:15 +00:00
|
|
|
changeOrigin: true,
|
|
|
|
rewrite: (path) => path.replace(/^\/outputs/, ''),
|
|
|
|
},
|
2022-10-03 16:15:26 +00:00
|
|
|
'/flaskwebgui-keep-server-alive': {
|
|
|
|
target: 'http://127.0.0.1:9090/flaskwebgui-keep-server-alive',
|
|
|
|
changeOrigin: true,
|
|
|
|
rewrite: (path) =>
|
|
|
|
path.replace(/^\/flaskwebgui-keep-server-alive/, ''),
|
|
|
|
},
|
2022-09-29 05:34:11 +00:00
|
|
|
// Proxy socket.io to the flask-socketio server
|
|
|
|
'/socket.io': {
|
|
|
|
target: 'ws://127.0.0.1:9090',
|
|
|
|
ws: true,
|
|
|
|
},
|
2022-09-16 17:18:15 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
build: {
|
|
|
|
target: 'esnext',
|
|
|
|
chunkSizeWarningLimit: 1500, // we don't really care about chunk size
|
|
|
|
},
|
|
|
|
};
|
|
|
|
if (mode == 'development') {
|
|
|
|
return {
|
|
|
|
...common,
|
|
|
|
build: {
|
|
|
|
...common.build,
|
|
|
|
// sourcemap: true, // this can be enabled if needed, it adds ovwer 15MB to the commit
|
|
|
|
},
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
return {
|
|
|
|
...common,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
});
|