Skip to content

Commit bc5eb5f

Browse files
authored
Don't auto polyfill on web (#456)
1 parent 8cb3eb1 commit bc5eb5f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ react-native-url-polyfill is an implementation of the WHATWG [URL Standard](http
3737
- **Blob support**. Supports React Native's Blob without additional steps.
3838
- **Hermes support**. Supports [Hermes](https://github.com/facebook/hermes), a JavaScript engine optimized for running React Native.
3939
- **Expo support**. Supports [Expo](https://expo.dev/) and tested against.
40+
- **Web support**. Most of the time, this polyfill isn't useful on web and therefore using `react-native-url-polyfill/auto` will be no-op on web.
4041

4142
## Why do we need this?
4243

auto.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import {Platform} from 'react-native';
2+
13
import {setupURLPolyfill} from './index';
24

3-
setupURLPolyfill();
5+
if (Platform.OS !== 'web') {
6+
setupURLPolyfill();
7+
}

0 commit comments

Comments
 (0)