Skip to content

Commit

Permalink
fixup!: urlToFilename
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobJingleheimer committed Apr 9, 2024
1 parent 2cc1f24 commit 06693a1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/internal/modules/esm/translators.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const { dirname, extname, isAbsolute } = require('path');
const {
loadBuiltinModule,
stripBOM,
urlToFilename,
} = require('internal/modules/helpers');
const {
cjsExportsCache,
Expand Down Expand Up @@ -242,7 +243,7 @@ function loadCJSModule(module, source, url, filename) {
}
}
const { url: resolvedURL } = cascadedLoader.resolveSync(specifier, url, kEmptyObject);
return StringPrototypeStartsWith(resolvedURL, 'file://') ? fileURLToPath(resolvedURL) : resolvedURL;
return urlToFilename(resolvedURL);
});
setOwnProperty(requireFn, 'main', process.mainModule);

Expand All @@ -264,7 +265,7 @@ const cjsCache = new SafeMap();
function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) {
debug(`Translating CJSModule ${url}`);

const filename = StringPrototypeStartsWith(url, 'file://') ? fileURLToPath(url) : url;
const filename = urlToFilename(url);
// In case the source was not provided by the `load` step, we need fetch it now.
source = stringify(source ?? getSource(new URL(url)).source);

Expand Down

0 comments on commit 06693a1

Please sign in to comment.