From 413de2c95a3fcd1418a62405b6381b5da3e3c319 Mon Sep 17 00:00:00 2001 From: Jayden Seric Date: Wed, 28 Feb 2018 11:27:00 +1100 Subject: [PATCH] Support the .mjs extension by default. Fixes https://github.com/documentationjs/documentation/issues/1022. `.mjs` is ordered before `.js` as that is the resolution order in other tools such as Webpack v4. --- src/input/dependency.js | 2 +- src/merge_config.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/input/dependency.js b/src/input/dependency.js index 95eac7ae6..00fdeffb5 100644 --- a/src/input/dependency.js +++ b/src/input/dependency.js @@ -32,7 +32,7 @@ function dependencyStream( extensions: [] .concat(config.requireExtension || []) .map(ext => '.' + ext.replace(/^\./, '')) - .concat(['.js', '.json', '.es6', '.jsx']), + .concat(['.mjs', '.js', '.json', '.es6', '.jsx']), transform: [ babelify.configure({ sourceMap: false, diff --git a/src/merge_config.js b/src/merge_config.js index a14a49877..65126cf4c 100644 --- a/src/merge_config.js +++ b/src/merge_config.js @@ -84,6 +84,7 @@ function mergeConfigFile(config): Promise { function mergeConfig(config: Object): Promise { config.parseExtension = (config.parseExtension || []).concat([ + 'mjs', 'js', 'jsx', 'es5',