49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
import { fileURLToPath, URL } from 'node:url';
|
|
|
|
import { PrimeVueResolver } from '@primevue/auto-import-resolver';
|
|
import vue from '@vitejs/plugin-vue';
|
|
import Components from 'unplugin-vue-components/vite';
|
|
import { defineConfig } from 'vite';
|
|
|
|
function healthCheckPlugin() {
|
|
return {
|
|
name: 'vite-plugin-healthcheck',
|
|
configureServer(server) {
|
|
server.middlewares.use((req, res, next) => {
|
|
const url = req.url ? req.url.split('?')[0] : '';
|
|
if (url === '/health' || url === '/healthz') {
|
|
res.statusCode = 200;
|
|
res.setHeader('Content-Type', 'application/json');
|
|
res.end(JSON.stringify({ status: 'healthy', service: 'dashboard' }));
|
|
return;
|
|
}
|
|
next();
|
|
});
|
|
}
|
|
};
|
|
}
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
optimizeDeps: {
|
|
noDiscovery: true
|
|
},
|
|
plugins: [
|
|
vue(),
|
|
Components({
|
|
resolvers: [PrimeVueResolver()]
|
|
}),
|
|
healthCheckPlugin()
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
}
|
|
},
|
|
server: {
|
|
port: 5173,
|
|
host: true,
|
|
allowedHosts: ['mbmanager.ir', '.mbmanager.ir']
|
|
}
|
|
});
|