Skip to content

Commit

Permalink
fixup: naive solution to require.extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
MylesBorins committed Oct 15, 2019
1 parent 8762750 commit 935e46c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/internal/modules/esm/default_resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const { getOptionValue } = require('internal/options');
const preserveSymlinks = getOptionValue('--preserve-symlinks');
const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main');
const experimentalJsonModules = getOptionValue('--experimental-json-modules');
const esModuleSpecifierResolution =
getOptionValue('--es-module-specifier-resolution');
const typeFlag = getOptionValue('--input-type');
const experimentalWasmModules = getOptionValue('--experimental-wasm-modules');
const { resolve: moduleWrapResolve,
Expand Down Expand Up @@ -110,6 +112,8 @@ function resolve(specifier, parentURL) {
if (!format) {
if (isMain)
format = type === TYPE_MODULE ? 'module' : 'commonjs';
else if (esModuleSpecifierResolution === 'node')
format = 'commonjs';
else
throw new ERR_UNKNOWN_FILE_EXTENSION(fileURLToPath(url));
}
Expand Down
3 changes: 1 addition & 2 deletions src/module_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ static const char* const EXTENSIONS[] = {
".js",
".json",
".node",
".mjs",
".cjs"
".mjs"
};

ModuleWrap::ModuleWrap(Environment* env,
Expand Down

0 comments on commit 935e46c

Please sign in to comment.