mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 15:45:27 -05:00
Merge pull request #6683 from Microsoft/strip_quotes_in_modules_names
strip quotes from module names during deduplication
This commit is contained in:
@@ -7068,14 +7068,22 @@ const _super = (function (geti, seti) {
|
||||
|
||||
for (let i = 0; i < externalImports.length; i++) {
|
||||
const text = getExternalModuleNameText(externalImports[i], emitRelativePathAsModuleName);
|
||||
if (hasProperty(groupIndices, text)) {
|
||||
if (text === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// text should be quoted string
|
||||
// for deduplication purposes in key remove leading and trailing quotes so 'a' and "a" will be considered the same
|
||||
const key = text.substr(1, text.length - 2);
|
||||
|
||||
if (hasProperty(groupIndices, key)) {
|
||||
// deduplicate/group entries in dependency list by the dependency name
|
||||
const groupIndex = groupIndices[text];
|
||||
const groupIndex = groupIndices[key];
|
||||
dependencyGroups[groupIndex].push(externalImports[i]);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
groupIndices[text] = dependencyGroups.length;
|
||||
groupIndices[key] = dependencyGroups.length;
|
||||
dependencyGroups.push([externalImports[i]]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user