fix: Build stage stalling
Build stage would stall after finishing, this could cause some issue when containerization is implemented, so I wrote a vite plugin to auto kill it after it finished bundling.
This commit is contained in:
parent
4149066d74
commit
66db8babbf
23
src/lib/functions/autoCloseViteBuild.ts
Normal file
23
src/lib/functions/autoCloseViteBuild.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import type { PluginOption } from 'vite';
|
||||
|
||||
export default function closePlugin() {
|
||||
const plugin: PluginOption = {
|
||||
name: 'BuildWatcher',
|
||||
buildEnd: function (error?: Error) {
|
||||
if (error) {
|
||||
console.error('\x1b[35m[BuildWatcher]\x1b[0m Error building.');
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
} else {
|
||||
console.log('\x1b[35m[BuildWatcher]\x1b[0m Build Stage Ended.');
|
||||
}
|
||||
},
|
||||
|
||||
closeBundle: function () {
|
||||
console.log('\x1b[35m[BuildWatcher]\x1b[0m Bundle closed');
|
||||
process.exit(0);
|
||||
},
|
||||
};
|
||||
|
||||
return plugin;
|
||||
}
|
@ -1,10 +1,12 @@
|
||||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import { defineConfig } from 'vite';
|
||||
import { startupSocketIOServer } from './src/lib/functions/websocketConfig';
|
||||
import closePlugin from './src/lib/functions/autoCloseViteBuild';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
sveltekit(),
|
||||
closePlugin(),
|
||||
{
|
||||
name: 'integratedSocketIOServer',
|
||||
configureServer(server) {
|
||||
|
Loading…
Reference in New Issue
Block a user