install yarn add babel-plugin-lf-debug -D 使用 插件使用 { "plugins": [ ["babel-plugin-lf-debug", { "useDebug": true }] ] } 编写代码 console.log('before') if(DEBUG){ console.log('23') let a = 2 let b = 3 console.log("a+b", a+b) } 兼容eslint //src/.eslintrc.js module.exports = { globals: { DEBUG: true, }, };