Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
babel-plugin-transform-remove-console
Advanced tools
The babel-plugin-transform-remove-console package is a Babel plugin that removes all console.* calls from your JavaScript code. This is particularly useful for production builds where you want to clean up debugging statements.
Remove all console statements
This feature removes all console statements such as console.log, console.error, etc., from the code. After applying the plugin, the resulting code will not contain any console statements.
const example = () => {
console.log('This will be removed');
console.error('This will also be removed');
return 'Hello, World!';
};
This package removes all debugger statements from your code. It is similar to babel-plugin-transform-remove-console but focuses on removing debugger statements instead of console statements.
This package removes dead code from your JavaScript files. While it does not specifically target console statements, it can remove code that is never executed, which may include some console statements.
This plugin removes all console.*
calls.
In
console.log("foo");
console.error("bar");
Out
npm install babel-plugin-transform-remove-console --save-dev
.babelrc
(Recommended).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.FAQs
Remove all console.* calls.
The npm package babel-plugin-transform-remove-console receives a total of 241,517 weekly downloads. As such, babel-plugin-transform-remove-console popularity was classified as popular.
We found that babel-plugin-transform-remove-console demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.