Skip to content

Commit

Permalink
keep console.log() when serving webapp
Browse files Browse the repository at this point in the history
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".
  • Loading branch information
schlimmchen authored and tbnobody committed Nov 5, 2024
1 parent 3c56ec3 commit 3948adf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions webapp/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ try {
}

// https://vitejs.dev/config/
export default defineConfig({
export default defineConfig(({ command }) => { return {
plugins: [
vue(),
viteCompression({ deleteOriginFile: true, threshold: 0 }),
Expand Down Expand Up @@ -59,7 +59,7 @@ export default defineConfig({
target: 'es2022',
},
esbuild: {
drop: ['console', 'debugger'],
drop: command !== 'serve' ? ['console', 'debugger'] : []
},
server: {
proxy: {
Expand All @@ -78,4 +78,4 @@ export default defineConfig({
}
}
}
})
} })

0 comments on commit 3948adf

Please sign in to comment.