Bug Report
Input Code
const path = require('path');
const {transformSync} = require('@babel/core');
transformSync('', {
filename: path.resolve('filename.js'),
plugins: [
() => ({
visitor: {
Program(path) {
throw path.buildCodeFrameError('example error');
}
}
})
]
});
Expected behavior/code
The first line of error.message should be /path/to/filename.js: example error
Current Behavior
The first line of error.message is /path/to/filename.js: /path/to/filename.js: example error
Babel Configuration (.babelrc, package.json, cli command)
None / see code.
Environment
- Babel version(s): 7.6.3
- Node/npm version: node 8+
- OS: all
- Monorepo: no
- How you are using Babel: API
Possible Solution
Since packages/babel-core/src/transformation/index.js now prepends the error with the message maybe path.buildCodeFrameError should not do the same.
Additional context/Screenshots
Introduced by #10511. CC @JLHwung
Bug Report
Input Code
Expected behavior/code
The first line of error.message should be
/path/to/filename.js: example errorCurrent Behavior
The first line of error.message is
/path/to/filename.js: /path/to/filename.js: example errorBabel Configuration (.babelrc, package.json, cli command)
None / see code.
Environment
Possible Solution
Since packages/babel-core/src/transformation/index.js now prepends the error with the message maybe
path.buildCodeFrameErrorshould not do the same.Additional context/Screenshots
Introduced by #10511. CC @JLHwung