Skip to content

Commit

Permalink
Remove overly aggressive optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperisager committed Dec 17, 2024
1 parent 3f78f06 commit 4a1a822
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,20 +268,20 @@ exports.imports = function* (
url.protocol === builtinProtocol ||
url.protocol === linkedProtocol
) {
if (addResolution(imports, specifier, matchedConditions, url)) {
resolved = yielded = true
}
addResolution(imports, specifier, matchedConditions, url)

resolved = yielded = true
} else {
const source = yield { module: url }

if (source !== null) {
if (addResolution(imports, specifier, matchedConditions, url)) {
yield {
children: exports.module(url, source, artifacts, visited, opts)
}
addResolution(imports, specifier, matchedConditions, url)

resolved = yielded = true
yield {
children: exports.module(url, source, artifacts, visited, opts)
}

resolved = yielded = true
}
}

Expand Down Expand Up @@ -532,8 +532,6 @@ function addResolution(imports, specifier, conditions, url) {

const last = conditions[conditions.length - 1]

if (last in current) return false

current[last] = url.href

if ('default' in current) {
Expand All @@ -543,8 +541,6 @@ function addResolution(imports, specifier, conditions, url) {

current.default = value
}

return true
}

function compressImportsMap(imports) {
Expand Down

0 comments on commit 4a1a822

Please sign in to comment.