babel-plugin-code-cleaner
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

babel-plugin-code-cleaner

babel代码清洁工,删除指定的调试代码:console & debugger

插件安装

npm install babel-plugin-code-cleaner -D

babel配置

babel.config.js

{
  "plugins": ["babel-plugin-code-cleaner"]
}

添加配置参数

{
  "plugins": [["code-cleaner", {
    "env": "production", // 始终执行cleaner
    "ignoreDebug": true, // 忽略 debugger的清除
    "commentWord": "@ignore-code-cleaner" // 默认值
  }]]
}

配置项

参数 类型 默认值 介绍
env string env === 'production',则始终执行cleaner
ignoreDebug boolean false 跳过debugger的cleaner
commentWord string @ignore-code-cleaner 遇到注释跳过cleaner,类似于 // @ts-ignore

Package Sidebar

Install

npm i babel-plugin-code-cleaner

Weekly Downloads

2

Version

0.1.3

License

MIT

Unpacked Size

11.8 kB

Total Files

11

Last publish

Collaborators

  • ghyghoo8