add .mjs to list of well known extensions
this is to conform to the plan of the Node.js EP
This commit is contained in:
committed by
Logan Smyth
parent
685006433b
commit
7ca81700f7
@@ -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 */
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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"]);
|
||||
|
||||
@@ -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.
|
||||
|
||||
<blockquote class="babel-callout babel-callout-info">
|
||||
<h4>Polyfill not included</h4>
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user