Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup: naive solution to require.extensions
  • Loading branch information
MylesBorins committed Oct 15, 2019
commit 935e46c23168f9e639a83dcb446ab9118597e205
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