From fcf21ac1d67bd409caf515da92f1c63cf5852261 Mon Sep 17 00:00:00 2001 From: Bernhard Kirchen Date: Sun, 3 Nov 2024 11:43:08 +0100 Subject: [PATCH] keep console.log() when serving webapp the removal of console and debugger statements by esbuild even when not building for production seems to be a regression, as these were definitely working in the past. this change uses the command parameter to configure esbuild to either keep or indeed remove the respective statements. they are only kept if command is not "serve". to avoid having to indent everything in defineConfig() by one block, the return statement and closing curly brace were added "inline". --- webapp/vite.config.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/vite.config.ts b/webapp/vite.config.ts index b898ee97e..7be46b198 100644 --- a/webapp/vite.config.ts +++ b/webapp/vite.config.ts @@ -19,7 +19,7 @@ try { } // https://vitejs.dev/config/ -export default defineConfig({ +export default defineConfig(({ command }) => { return { plugins: [ vue(), viteCompression({ deleteOriginFile: true, threshold: 0 }), @@ -57,7 +57,7 @@ export default defineConfig({ }, }, esbuild: { - drop: ['console', 'debugger'], + drop: command !== 'serve' ? ['console', 'debugger'] : [] }, server: { proxy: { @@ -86,4 +86,4 @@ export default defineConfig({ } } } -}) +} })