Skip to content
Open
Changes from 2 commits
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
12 changes: 5 additions & 7 deletions lib/internal/modules/esm/get_format.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,18 @@ const protocolHandlers = ObjectAssign(ObjectCreate(null), {
if (ext === '.js') {
format = getPackageType(parsed.href) === 'module' ? 'module' : 'commonjs';
Comment thread
iam-frankqiu marked this conversation as resolved.
} else {
format = extensionFormatMap[ext];
format = extensionFormatMap[ext] || legacyExtensionFormatMap[ext] || null;
Comment thread
iam-frankqiu marked this conversation as resolved.
Outdated
}
if (!format) {
if (experimentalSpecifierResolution === 'node') {
if (!extensionFormatMap[ext]) {
if (experimentalSpecifierResolution === 'node')
process.emitWarning(
'The Node.js specifier resolution in ESM is experimental.',
'ExperimentalWarning');
format = legacyExtensionFormatMap[ext];
} else {
else
throw new ERR_UNKNOWN_FILE_EXTENSION(ext, fileURLToPath(url));
}
}

return format || null;
return format;
},
'node:'() { return 'builtin'; },
});
Expand Down