This plugin removes all console.*
calls.
In
console.log("foo");
console.error("bar");
Out
npm install babel-plugin-transform-remove-console --save-dev
.babelrc
// without options
{
"plugins": ["transform-remove-console"]
}
// with options
{
"plugins": [ ["transform-remove-console", { "exclude": [ "error", "warn"] }] ]
}
babel --plugins transform-remove-console script.js
require("@babel/core").transform("code", {
plugins: ["transform-remove-console"]
});
exclude
- An array of console methods to exclude from removal.