Skip to content

Commit 328c312

Browse files
authored
Don't polyfill fetch for Node (#5132)
1 parent 6510a27 commit 328c312

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: packages/react-app-polyfill/jsdom.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@
66
*/
77
'use strict';
88

9-
// fetch() polyfill for making API calls.
10-
require('whatwg-fetch');
9+
// Make sure we're in a Browser-like environment before importing polyfills
10+
// This prevents `fetch()` from being imported in a Node test environment
11+
if (typeof window !== 'undefined') {
12+
// fetch() polyfill for making API calls.
13+
require('whatwg-fetch');
14+
}

0 commit comments

Comments
 (0)