Skip to content

A Babel plugin that automatically add __debug variable for debugging and logging

Notifications You must be signed in to change notification settings

aztack/babel-plugin-transform-dbg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A Babel plugin that automatically add __debug variable for debugging and logging

Install

yarn add -D babel-plugin-transform-dbg

.babelrc

{
  "presets": ["@babel/env"],
  "plugins": ["@babel/transform-runtime", "babel-plugin-transform-dbg"]
}

Usage

in Object methods

// component.vue
const vm = {
  methods: {
    onSomeEvent () {
      console.log(__debug) // {file:"/absolute/path/to/component.vue",line:4,method:"onSomeEvent"}
    }
  }
}

in function

// a.js
function test () {
   console.log(__debug); // {file:"/absolute/path/to/a.js",line:2,method:"test"}
}
test()

About

A Babel plugin that automatically add __debug variable for debugging and logging

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published