From e62047f17ca4097f00f0ae32944ced28166f4f1b Mon Sep 17 00:00:00 2001 From: rektide de la faye Date: Wed, 24 Feb 2021 23:38:08 -0500 Subject: [PATCH] assume extension-less scripts are js scripts. resolves #37512 Fixes: https://github.com/nodejs/node/issues/37512 --- lib/internal/modules/esm/get_format.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/modules/esm/get_format.js b/lib/internal/modules/esm/get_format.js index f02bb5cde70772..9ee7d473a74ef2 100644 --- a/lib/internal/modules/esm/get_format.js +++ b/lib/internal/modules/esm/get_format.js @@ -56,7 +56,7 @@ function defaultGetFormat(url, context, defaultGetFormatUnused) { } else if (parsed.protocol === 'file:') { const ext = extname(parsed.pathname); let format; - if (ext === '.js') { + if (ext === '.js' || ext === '') { format = getPackageType(parsed.href) === 'module' ? 'module' : 'commonjs'; } else { format = extensionFormatMap[ext];