Replace instances of
HERE
identifier with code position strings.
This plugin is useful when you don't have sourcemaps and you're looking at errors in the console and having trouble knowing where they've come from. You can setup this plugin, and use HERE
in error message like throw new Error(`${HERE} Some useful message`)
.
npm install --save-dev babel-plugin-here
babel.config.json
{
"plugins": [ "babel-plugin-here" ]
}
tsconfig.json
{
"compilerOptions": {
"types": [ "babel-plugin-here/env" ]
}
}
src/foo.js
console.log(HERE)
dist/foo.js
console.log("src/foo.js:1:13")