From eada9847239a4834a28ce197030734ee4563b104 Mon Sep 17 00:00:00 2001 From: Julian Grinblat Date: Tue, 23 Feb 2021 07:14:59 +0900 Subject: [PATCH] Add cjs to default babel-node extensions (#2415) * Add cjs to default babel-node extensions * Remove unnecessary space --- docs/core.md | 2 +- docs/node.md | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/core.md b/docs/core.md index c2e5dd944d..3a2729ab69 100644 --- a/docs/core.md +++ b/docs/core.md @@ -309,7 +309,7 @@ Each `ConfigItem` exposes all of the information Babel knows. The fields are: > babel.DEFAULT_EXTENSIONS: ReadonlyArray -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`. diff --git a/docs/node.md b/docs/node.md index b0c6262fd0..6688e9eb6e 100644 --- a/docs/node.md +++ b/docs/node.md @@ -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'. |