Cocos Creator v3.0.1 dead code elimination

Is there a way to remove dead code based on the constants I defined in CocosCreator 3.0.1?

if (EDITOR) {
  console.log('is EDITOR');
} else {
  console.log('is not EDITOR');
}

// What I want to do is the following code.
if (MY_CUSTOM_CONSTANT_VALUE) {
  console.log('MY_CUSTOM_CONSTANT_VALUE is true');
} else {
  console.log('MY_CUSTOM_CONSTANT_VALUE is false');
}
// After the build, I want to remove the unreachable code.
// EDITOR=false
// MY_CUSTOM_CONSTANT_VALUE=true
console.log('is not EDITOR'); 
console.log('MY_CUSTOM_CONSTANT_VALUE is true');