/ packages / webui / vite.config.ts
vite.config.ts
 1  import { defineConfig } from 'vite';
 2  import { nodePolyfills } from 'vite-plugin-node-polyfills'
 3  
 4  // https://vitejs.dev/config/
 5  export default defineConfig(({ command, mode }) => {
 6  	const isProd = mode === 'production';
 7  	return {
 8  		build: {
 9  			outDir: 'dist',
10  			emptyOutDir: true,
11  			minify: isProd,
12  			sourcemap: command === 'serve',
13  			rollupOptions: { treeshake: true }
14  		},
15  		plugins: [
16  			nodePolyfills({
17  				include: ['crypto', 'buffer', 'stream', 'util'],
18  				globals: {
19  					Buffer: true,
20  					global: true,
21  					process: true,
22  				},
23  				protocolImports: true,
24  			})
25  		],
26  	};
27  });