Skip to content

Commit

Permalink
Make module namespace sort compare function consistent (#14287)
Browse files Browse the repository at this point in the history
  • Loading branch information
devsnek committed Feb 21, 2022
1 parent a35af3e commit 79d6255
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/babel-helper-module-transforms/src/index.ts
Expand Up @@ -449,7 +449,11 @@ function buildExportInitializationStatements(
// https://tc39.es/ecma262/#sec-module-namespace-exotic-objects
// The [Exports] list is ordered as if an Array of those String values
// had been sorted using %Array.prototype.sort% using undefined as comparefn
initStatements.sort((a, b) => (a[0] > b[0] ? 1 : -1));
initStatements.sort(([a], [b]) => {
if (a < b) return -1;
if (b < a) return 1;
return 0;
});

const results = [];
if (noIncompleteNsImportDetection) {
Expand Down

0 comments on commit 79d6255

Please sign in to comment.