diff --git a/packages/babel-cli/src/_babel-node.js b/packages/babel-cli/src/_babel-node.js index 28b62dd2c0..4b9ac5160a 100644 --- a/packages/babel-cli/src/_babel-node.js +++ b/packages/babel-cli/src/_babel-node.js @@ -26,7 +26,7 @@ program.option("-e, --eval [script]", "Evaluate script"); program.option("-p, --print [code]", "Evaluate script and print result"); program.option("-o, --only [globs]", "A comma-separated list of glob patterns to compile", collect); program.option("-i, --ignore [globs]", "A comma-separated list of glob patterns to skip compiling", collect); -program.option("-x, --extensions [extensions]", "List of extensions to hook into [.es6,.js,.es,.jsx]", collect); +program.option("-x, --extensions [extensions]", "List of extensions to hook into [.es6,.js,.es,.jsx,.mjs]", collect); program.option("-w, --plugins [string]", "", collect); program.option("-b, --presets [string]", "", collect); /* eslint-enable max-len */ diff --git a/packages/babel-cli/src/babel/index.js b/packages/babel-cli/src/babel/index.js index 732ba1b011..42b949f952 100755 --- a/packages/babel-cli/src/babel/index.js +++ b/packages/babel-cli/src/babel/index.js @@ -67,7 +67,7 @@ commander.option("-M, --module-ids", "insert an explicit id for modules"); commander.option("--module-id [string]", "specify a custom name for module ids"); // "babel" command specific arguments that are not passed to babel-core. -commander.option("-x, --extensions [extensions]", "List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx]", collect); +commander.option("-x, --extensions [extensions]", "List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx,.mjs]", collect); commander.option("-w, --watch", "Recompile files on changes"); commander.option("--skip-initial-build", "Do not compile files before watching"); commander.option("-o, --out-file [out]", "Compile all input files into a single file"); diff --git a/packages/babel-core/src/index.js b/packages/babel-core/src/index.js index eca8d122e7..918929f9bc 100644 --- a/packages/babel-core/src/index.js +++ b/packages/babel-core/src/index.js @@ -41,4 +41,4 @@ export { * Recommended set of compilable extensions. Not used in babel-core directly, but meant as * as an easy source for tooling making use of babel-core. */ -export const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es"]); +export const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs"]); diff --git a/packages/babel-register/README.md b/packages/babel-register/README.md index 413e7a6349..691e8cc2e7 100644 --- a/packages/babel-register/README.md +++ b/packages/babel-register/README.md @@ -19,8 +19,8 @@ npm install babel-register --save-dev require("babel-register"); ``` -All subsequent files required by node with the extensions `.es6`, `.es`, `.jsx` -and `.js` will be transformed by Babel. +All subsequent files required by node with the extensions `.es6`, `.es`, `.jsx`, +`.mjs`, and `.js` will be transformed by Babel.

Polyfill not included

@@ -64,9 +64,9 @@ require("babel-register")({ // aren't compiled only: /my_es6_folder/, - // Setting this will remove the currently hooked extensions of .es6, `.es`, `.jsx` + // Setting this will remove the currently hooked extensions of `.es6`, `.es`, `.jsx`, `.mjs` // and .js so you'll have to add them back if you want them to be used again. - extensions: [".es6", ".es", ".jsx", ".js"], + extensions: [".es6", ".es", ".jsx", ".js", ".mjs"], // Setting this to false will disable the cache. cache: true