1.npm安装插件:npm install babel-plugin-transform-remove-console --save-dev

2.於 babel.config.js 中

加入以下片段

const plugins = []
if (process.env.ENV === 'development' || process.env.ENV === 'staging') {
  plugins.push('dynamic-import-node')
} else {
  plugins.push('transform-remove-console')
}
 
module.exports = {
  presets: [
    '@vue/cli-plugin-babel/preset'
  ],
  plugins: plugins
}
arrow
arrow
    文章標籤
    vue console.log hide 屏蔽
    全站熱搜

    狼翔月影 發表在 痞客邦 留言(0) 人氣()