yarn add -D babel-plugin-transform-dbg
{
"presets": ["@babel/env"],
"plugins": ["@babel/transform-runtime", "babel-plugin-transform-dbg"]
}
// component.vue
const vm = {
methods: {
onSomeEvent () {
console.log(__debug) // {file:"/absolute/path/to/component.vue",line:4,method:"onSomeEvent"}
}
}
}
// a.js
function test () {
console.log(__debug); // {file:"/absolute/path/to/a.js",line:2,method:"test"}
}
test()