Skip to content

Commit 9ed1dfc

Browse files
committed
fix: do not export duplicate keys
1 parent dbca30c commit 9ed1dfc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/compile-exports.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ module.exports = function compileExports(result, importItemMatcher, camelCaseKey
1616
valueAsString = valueAsString.replace(result.importItemRegExpG, importItemMatcher);
1717
res.push("\t" + JSON.stringify(key) + ": " + valueAsString);
1818

19-
if (camelCaseKeys === true) {
20-
res.push("\t" + JSON.stringify(camelCase(key)) + ": " + valueAsString);
21-
} else if (camelCaseKeys === 'dashes') {
22-
res.push("\t" + JSON.stringify(dashesCamelCase(key)) + ": " + valueAsString);
19+
var targetKey;
20+
if (camelCaseKeys === true && (targetKey = camelCase(key)) !== key) {
21+
res.push("\t" + JSON.stringify(targetKey) + ": " + valueAsString);
22+
} else if (camelCaseKeys === 'dashes' && (targetKey = dashesCamelCase(key)) !== key) {
23+
res.push("\t" + JSON.stringify(targetKey) + ": " + valueAsString);
2324
}
2425

2526
return res;

0 commit comments

Comments
 (0)