babel / babel/babel

[Bug]: `@babel/register` has incorrect `sourceMaps` default settings

Open
#14,021 4 comments 0 reactions 0 assignees View on GitHub
pkg: register
Dominant language
TypeScript
Stars
44k
Forks
6k
Avg merge
5d 15h
Merged PRs (30d)
23

Description

### 💻

- [ ] Would you like to work on a fix?

### How are you using Babel?

@babel/register or @babel/node

### Input code

Any code.

### Configuration file name

babel.config.js

### Configuration

```js
module.exports = {
sourceMaps: undefined
};
```

### Current and expected behavior

**Current Behavior**

`@babel/register` in [this line](https://github.com/babel/babel/blob/master/packages/babel-register/src/node.js#L64) sets the default to `"both"`:

`sourceMaps: opts.sourceMaps === undefined ? "both" : opts.sourceMaps`

**Expected Behavior**

[According to the documentation](https://babeljs.io/docs/en/options#sourcemaps), the default should be `false`.

### Environment

@babel/register: 7.10.1

### Possible solution

Change code to:

```
sourceMaps: opts.sourceMaps === undefined ? false : opts.sourceMaps
```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at packages/babel-register/src/node.js, specifically the sourceMaps default around line 64, and compare it with the documented default in the Babel options documentation. Done means @babel/register uses false when sourceMaps is undefined while preserving an explicitly supplied value.

Written by the indexing model from the issue text.

Assessment

Tech stack
babel, javascript
Domain
tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.