A Babel plugin that adds build-time console helper functions to automatically log function parameters, variables, return values, and parent scope — eliminating manual console.log debugging. Current stable version is 0.2.1, released as a series of patches since 2017. Key differentiator: it requires no runtime changes, works with babel-plugin-macros, and supports both browser and Node environments. Unlike manual logging, it provides structured scope inspection at build time, reducing clutter and context loss.
npm install babel-plugin-consoleVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic plugin setup and using console.scope to log function scope details.
Upgrade to 0.2.0+.
Use import scope from 'babel-plugin-console/scope.macro'.
Move variable declarations instead of imports for logging purposes.
No action required.
Ensure babel-plugin-console is installed and listed in plugins as 'console'.
Install babel-plugin-macros and use exact import path 'babel-plugin-console/scope.macro'.
Run code through Babel with the plugin enabled.