Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/commonjs/src/transform-commonjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,12 @@ export default async function transformCommonjs(
case 'global':
uses.global = true;
if (!ignoreGlobal) {
if (isShorthandProperty(parent)) {
// as key and value are the same object, isReference regards
// both as references, so we need to skip now
skippedNodes.add(parent.value);
magicString.prependRight(node.start, 'global: ');
}
replacedGlobal.push(node);
}
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
description: 'correctly replaces shorthand `global` property in object'
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const HOST = {
global
};

module.exports = {
HOST
};