Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aztack/babel-plugin-transform-dbg
A Babel plugin that automatically add __debug variable for debugging and logging
https://github.com/aztack/babel-plugin-transform-dbg
babel babel-plugin debugging filename line logging
Last synced: about 23 hours ago
JSON representation
A Babel plugin that automatically add __debug variable for debugging and logging
- Host: GitHub
- URL: https://github.com/aztack/babel-plugin-transform-dbg
- Owner: aztack
- Created: 2019-02-07T02:49:22.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-07T07:46:23.000Z (almost 6 years ago)
- Last Synced: 2024-11-14T07:42:32.140Z (3 days ago)
- Topics: babel, babel-plugin, debugging, filename, line, logging
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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()
```