Skip to content

Commit

Permalink
Use toURL() in createRequire()
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperisager committed Oct 11, 2024
1 parent f0ea7fa commit b8b0e2b
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,14 +572,6 @@ exports.isBuiltin = function isBuiltin () {
const createRequire = exports.createRequire = function createRequire (parentURL, opts = {}) {
const self = Module

if (typeof parentURL === 'string') {
if (startsWithWindowsDriveLetter(parentURL)) {
parentURL = '/' + parentURL
}

parentURL = new URL(parentURL, 'file:')
}

let {
module = null,

Expand All @@ -596,7 +588,7 @@ const createRequire = exports.createRequire = function createRequire (parentURL,
} = opts

if (module === null) {
module = new Module(parentURL)
module = new Module(toURL(parentURL))

module._type = type
module._defaultType = defaultType
Expand Down

0 comments on commit b8b0e2b

Please sign in to comment.