You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Marking a function call as pure means "remove the function call but still evaluate the arguments" so this is expected behavior. The arguments will be preserved if they can't be proven to have no side effects, and esbuild considers running the ToString operation on a variable to be a side effect. I do not consider this to be a bug.
If you want to remove the console.log call entirely (including not evaluating the arguments), marking the function call as pure is not the way to do that. One way to do that is to move the console.log behind a conditional and then use --define to disable the conditional. An example would be doing something like this and then using something like --define:global.NO_LOG=true to remove the call entirely:
Tested on 0.14.7.
There are three more cases related to
console.log
on--pure
and--minify
settings:source
index.js
:yields
out.js
:source
index.js
:same command,
yields
out.js
:source
index.js
:same command,
yields
out.js
:The text was updated successfully, but these errors were encountered: