babel-plugin-pretty-console
Use hooks for fast console.log
Install
npm install babel-plugin-pretty-console -D
Usage
Configure PrettyConsole
to your .babelrc
file.
{
"plugins": ["pretty-console"]
}
Examples
function add(a, b) {
return a + b;
}
function add(a, b) {
console.log('add:a', a)
console.log('add:b', b)
return a + b;
}
let a = add(1, 2)
let a = add(1, 2)
console.warn(a)
let add = (a, b) => a + b
let add = (a, b) => {
console.error('TestFunction:a', a)
console.error('TestFunction:b', b)
return a + b
}
Plugin options
- token
Set hook token used in comments
- open
Set plugin enabled status
- printFileName
Set print filename to console.log