Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cjs to default babel-node extensions #2415

Merged
merged 2 commits into from Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/core.md
Expand Up @@ -310,7 +310,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'. |