Skip to content

Commit

Permalink
Add cjs to default babel-node extensions (#2415)
Browse files Browse the repository at this point in the history
* Add cjs to default babel-node extensions

* Remove unnecessary space
  • Loading branch information
perrin4869 committed Feb 22, 2021
1 parent 29741d0 commit eada984
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/core.md
Expand Up @@ -309,7 +309,7 @@ Each `ConfigItem` exposes all of the information Babel knows. The fields are:

> babel.DEFAULT_EXTENSIONS: ReadonlyArray<string>
A list of default extensions supported by babel (".js", ".jsx", ".es6", ".es", ".mjs").
A list of default extensions supported by babel (".js", ".jsx", ".es6", ".es", ".mjs", "cjs").
This list is used by @babel/register and @babel/cli to determine which files need transpiling.
Extending this list isn't possible, however @babel/cli does provide ways to support other extensions with `--extensions`.

Expand Down
22 changes: 11 additions & 11 deletions docs/node.md
Expand Up @@ -76,14 +76,14 @@ npx babel-node --inspect --presets @babel/preset-env -- script.js --inspect

### Options

| Option | Default | Description |
| ---------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `-e, --eval [script]` | | Evaluate script |
| `-p, --print` | | Evaluate script and print result |
| `-i, --ignore [regex]` | `node_modules` | Ignore all files that match this regex when using the require hook. If both `-i` and `-o` are omitted, files outside the current working directory are also ignored. |
| `-o, --only [regex]` | current working directory | Only include (and exclude all other) files that match this regex when using the require hook. If both `-i` and `-o` are omitted, files outside the current working directory are also ignored. |
| `-x, --extensions` | `".js",".jsx",".es6",".es"` | List of extensions to hook into |
| `--presets` | `[]` | Comma-separated list of [presets](presets.md) (a set of plugins) to load and use. |
| `--plugins` | `[]` | Comma-separated list of [plugins](plugins.md) to load and use. |
| `--config-file [path]` | `[]` | Path to the babel config file to use. Defaults to working directory `babel.config.json` or `babel.config.js` |
| `--env-name [name]` | `[]` | The name of the 'env' to use when loading configs and plugins. Defaults to the value of BABEL_ENV, or else NODE_ENV, or else 'development'. |
| Option | Default | Description |
| ---------------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `-e, --eval [script]` | | Evaluate script |
| `-p, --print` | | Evaluate script and print result |
| `-i, --ignore [regex]` | `node_modules` | Ignore all files that match this regex when using the require hook. If both `-i` and `-o` are omitted, files outside the current working directory are also ignored. |
| `-o, --only [regex]` | current working directory | Only include (and exclude all other) files that match this regex when using the require hook. If both `-i` and `-o` are omitted, files outside the current working directory are also ignored. |
| `-x, --extensions` | `".js",".jsx",".es6",".es","cjs"` | List of extensions to hook into |
| `--presets` | `[]` | Comma-separated list of [presets](presets.md) (a set of plugins) to load and use. |
| `--plugins` | `[]` | Comma-separated list of [plugins](plugins.md) to load and use. |
| `--config-file [path]` | `[]` | Path to the babel config file to use. Defaults to working directory `babel.config.json` or `babel.config.js` |
| `--env-name [name]` | `[]` | The name of the 'env' to use when loading configs and plugins. Defaults to the value of BABEL_ENV, or else NODE_ENV, or else 'development'. |

0 comments on commit eada984

Please sign in to comment.