Skip to content

Commit 7bd2a61

Browse files
committed
Remove unnecessary lines for hasBadMapPolyfill issue for rollup
1 parent c0cd1be commit 7bd2a61

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

packages/react-reconciler/src/ReactFiber.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,10 @@ if (__DEV__) {
101101
hasBadMapPolyfill = false;
102102
try {
103103
const nonExtensibleObject = Object.preventExtensions({});
104-
const testMap = new Map([[nonExtensibleObject, null]]);
105-
const testSet = new Set([nonExtensibleObject]);
106-
// This is necessary for Rollup to not consider these unused.
107-
// https://github.com/rollup/rollup/issues/1771
108-
// TODO: we can remove these if Rollup fixes the bug.
109-
testMap.set(0, 0);
110-
testSet.add(0);
104+
/* eslint-disable no-new */
105+
new Map([[nonExtensibleObject, null]]);
106+
new Set([nonExtensibleObject]);
107+
/* eslint-enable no-new */
111108
} catch (e) {
112109
// TODO: Consider warning about bad polyfills
113110
hasBadMapPolyfill = true;

packages/react/src/BadMapPolyfill.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@ if (__DEV__) {
1212
hasBadMapPolyfill = false;
1313
try {
1414
const frozenObject = Object.freeze({});
15-
const testMap = new Map([[frozenObject, null]]);
16-
const testSet = new Set([frozenObject]);
17-
// This is necessary for Rollup to not consider these unused.
18-
// https://github.com/rollup/rollup/issues/1771
19-
// TODO: we can remove these if Rollup fixes the bug.
20-
testMap.set(0, 0);
21-
testSet.add(0);
15+
/* eslint-disable no-new */
16+
new Map([[frozenObject, null]]);
17+
new Set([frozenObject]);
18+
/* eslint-enable no-new */
2219
} catch (e) {
2320
// TODO: Consider warning about bad polyfills
2421
hasBadMapPolyfill = true;

0 commit comments

Comments
 (0)