zoukankan      html  css  js  c++  java
  • vue项目打包时去掉console.log()

    下载插件:npm install babel-plugin-transform-remove-console --save-dev

    babel.config.js中:(添加红字部分,表示仅在发布环境才去掉console.log)

    // 项目发布阶段需要用到的babel插件
    const prodPlugins = []
    if (process.env.NODE_ENV === 'production') {
      prodPlugins.push('transform-remove-console')
    }
    module.exports = {
      presets: ['@vue/cli-plugin-babel/preset'],
      plugins: [
        [
          'component',
          {
            libraryName: 'element-ui',
            styleLibraryName: 'theme-chalk'
          }
        ],
        // 发布产品时候的插件数组
        ...prodPlugins
      ]
    }
  • 相关阅读:
    vijos 1426
    2455 繁忙的都市
    2104 删除物品
    3235 战争
    BZOJ 2962
    COGS 265 线段覆盖
    P2184 贪婪大陆
    0729模拟赛解题报告
    BZOJ 1012
    BZOJ 2763
  • 原文地址:https://www.cnblogs.com/wuqilang/p/12789239.html
Copyright © 2011-2022 走看看