diff --git a/client/vite-plugin-close.ts b/client/vite-plugin-close.ts new file mode 100644 index 0000000000..9107f9adfb --- /dev/null +++ b/client/vite-plugin-close.ts @@ -0,0 +1,22 @@ +export default function ClosePlugin() { + return { + name: 'ClosePlugin', // required, will show up in warnings and errors + + // use this to catch errors when building + buildEnd(error) { + if(error) { + console.error('Error bundling') + console.error(error) + process.exit(1) + } else { + console.log('Build ended') + } + }, + + // use this to catch the end of a build without errors + closeBundle(id) { + console.log('Bundle closed') + process.exit(0) + }, + } +} diff --git a/client/vite.config.ts b/client/vite.config.ts index 3c0c429bb8..5378a82955 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -4,6 +4,7 @@ import { VitePWA } from 'vite-plugin-pwa'; import { defineConfig, createLogger } from 'vite'; import { nodePolyfills } from 'vite-plugin-node-polyfills'; import type { Plugin } from 'vite'; +import ClosePlugin from './vite-plugin-close.ts' const logger = createLogger(); const originalWarning = logger.warn; @@ -51,6 +52,7 @@ export default defineConfig({ envDir: '../', envPrefix: ['VITE_', 'SCRIPT_', 'DOMAIN_', 'ALLOW_'], plugins: [ + ClosePlugin(), react(), nodePolyfills(), VitePWA({