Skip to content

Commit e676e40

Browse files
committed
fix(minify): drop console.log / debug in prod mode
1 parent 4b1bdbd commit e676e40

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/compiler/app-core/optimize-module.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ export async function optimizeModule(config: d.Config, compilerCtx: d.CompilerCt
99
pure_getters: true,
1010
keep_fargs: false,
1111
passes: 2,
12+
pure_funcs: [
13+
'Console.log',
14+
'Console.debug'
15+
]
1216
},
1317
mangle: {
1418
toplevel: true,
@@ -19,7 +23,7 @@ export async function optimizeModule(config: d.Config, compilerCtx: d.CompilerCt
1923

2024
if (isCore) {
2125
opts.compress.passes = 4;
22-
opts.compress.pure_funcs = ['getHostRef'];
26+
opts.compress.pure_funcs = ['getHostRef', ...opts.compress.pure_funcs];
2327
opts.mangle.properties = {
2428
regex: '^\\$.+\\$$',
2529
debug: isDebug
@@ -59,6 +63,7 @@ export async function optimizeModule(config: d.Config, compilerCtx: d.CompilerCt
5963
opts.mangle.keep_fnames = true;
6064
opts.compress.drop_console = false;
6165
opts.compress.drop_debugger = false;
66+
opts.compress.pure_funcs = [];
6267
opts.output.beautify = true;
6368
opts.output.indent_level = 2;
6469
opts.output.comments = 'all';

0 commit comments

Comments
 (0)