How do I keep console.log #8463
Answered
by
rejhgadellaa
rejhgadellaa
asked this question in
Q&A
-
This may be a strange question as everybody is asking how to remove I explicitly set {
build: {
minify: 'terser',
terserOptions: {
compress: {
drop_console: false,
drop_debugger: false,
},
format: {
comments: false
},
},
sourcemap: true,
}
} Setting Full config for completeness: import { resolve } from 'path';
import { defineConfig } from 'vite';
import preact from '@preact/preset-vite';
import { createHtmlPlugin } from 'vite-plugin-html';
import visualizer from 'rollup-plugin-visualizer';
// https://vitejs.dev/config/
export default defineConfig( ({ }) => {
return {
plugins: [
preact(),
createHtmlPlugin({
minify: true,
}),
],
root: `${process.cwd()}/src`,
publicDir: 'assets',
cacheDir: `${process.cwd()}/.cache`,
build: {
outDir: '../dist',
emptyOutDir: true,
minify: 'terser',
terserOptions: {
compress: {
drop_console: false,
drop_debugger: false,
},
format: {
comments: false
},
},
sourcemap: true,
rollupOptions: {
plugins: [
visualizer({
filename: resolve(__dirname, 'stats.html'),
template: 'treemap',
}),
],
},
},
worker: {
format: 'es',
},
esbuild: {
loader: 'jsx',
},
optimizeDeps: {
exclude: ['rgui-preact-core'],
esbuildOptions: {
loader: {
'.js': 'jsx',
},
},
},
resolve: {
dedupe: ['preact', 'preact/hooks'],
},
};
}); |
Beta Was this translation helpful? Give feedback.
Answered by
rejhgadellaa
Jun 5, 2022
Replies: 1 comment 1 reply
-
Neeeevermind I copy/pasted some "silence console thing if |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
rejhgadellaa
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Neeeevermind I copy/pasted some "silence console thing if
process.env.NODE_ENV === 'development'
" code at some point and didn't realize it was in there.