From b8a7e0ddc2cd4c38cf0bca10e87e6507edbdefb6 Mon Sep 17 00:00:00 2001 From: Jayden Seric Date: Fri, 2 Mar 2018 04:06:49 +1100 Subject: [PATCH] feat: Support the .mjs extension by default. (#1023) 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 95eac7a..00fdeff 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 a14a498..65126cf 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',