Babel Missing Filename Example

This repo is a minimal example to reproduce an issue whereby Babel does not indicate the problematic file when it outputs an error.

Quickstart:

git clone https://github.com/codebling/babel-issue-example.git
cd babel-issue-example
nvm use 16.8    # or any version between 12 and 16.8, possibly even earlier versions
npm i
npm start       # or: ./node_modules/.bin/babel-node index.js

Expected Result

Using Node 16.9.0 or later, the problematic file name and lines are logged.

SyntaxError: /tmp/babel-issue-example/index.js: Legacy octal literals are not allowed in strict mode. (1:4)

> 1 | a = 01;
    |     ^
  2 |
    at Parser._raise (/tmp/babel-issue-example/node_modules/@babel/parser/lib/index.js:569:17

Actual Result

Using Node 16.8 or earlier, we don't see the file name (though the line numbers still appear).

SyntaxError: Legacy octal literals are not allowed in strict mode. (1:4)
    at Parser._raise (/tmp/babel-issue-example/node_modules/@babel/parser/lib/index.js:569:17)