You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docusaurus/docs/supported-browsers-features.md
+1-5
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ sidebar_label: Supported Browsers and Features
6
6
7
7
## Supported Browsers
8
8
9
-
By default, the generated project supports all modern browsers. Support for Internet Explorer 9, 10, and 11 requires polyfills. For a minimum set of polyfills to support older browsers, use [react-app-polyfill](https://github.com/facebook/create-react-app/blob/master/packages/react-app-polyfill/README.md). To polyfill other language features, see the [Adding Polyfills](#adding-polyfills) section below
9
+
By default, the generated project supports all modern browsers. Support for Internet Explorer 9, 10, and 11 requires polyfills. For a set of polyfills to support older browsers, use [react-app-polyfill](https://github.com/facebook/create-react-app/blob/master/packages/react-app-polyfill/README.md).
10
10
11
11
## Supported Language Features
12
12
@@ -27,10 +27,6 @@ Note that **this project includes no [polyfills](https://github.com/facebook/cre
27
27
28
28
If you use any other ES6+ features that need **runtime support** (such as `Array.from()` or `Symbol`), make sure you are [including the appropriate polyfills manually](https://github.com/facebook/create-react-app/blob/master/packages/react-app-polyfill/README.md), or that the browsers you are targeting already support them.
29
29
30
-
## Adding Polyfills
31
-
32
-
You can install [`@babel/polyfill`](https://babeljs.io/docs/en/babel-polyfill) as a dependency in your application, and import it at the very top of your app's entry point (`src/index.js` or `src/index.tsx`) to emulate a full ES2015+ environment. Your `browerslist` configuration will be used to only include the polyfills necessary by your target browsers.
33
-
34
30
## Configuring Supported Browsers
35
31
36
32
By default, the generated project includes a [`browerslist`](https://github.com/browserslist/browserslist) configuration in your `package.json` file to target a broad range of browsers based on global usage (`> 0.2%`) for production builds, and modern browsers for development. This gives a good development experience, especially when using language features such as async/await, but still provides high compatibility with many browsers in production.
Copy file name to clipboardExpand all lines: packages/react-app-polyfill/README.md
+46-13
Original file line number
Diff line number
Diff line change
@@ -3,18 +3,6 @@
3
3
This package includes polyfills for various browsers.
4
4
It includes minimum requirements and commonly used language features used by [Create React App](https://github.com/facebook/create-react-app) projects.
5
5
6
-
### Features
7
-
8
-
Each polyfill ensures the following language features are present:
9
-
10
-
1.`Promise` (for `async` / `await` support)
11
-
1.`window.fetch` (a Promise-based way to make web requests in the browser)
12
-
1.`Object.assign` (a helper required for Object Spread, i.e. `{ ...a, ...b }`)
13
-
1.`Symbol` (a built-in object used by `for...of` syntax and friends)
14
-
1.`Array.from` (a built-in static method used by array spread, i.e. `[...arr]`)
15
-
16
-
_If you need more features, you must include them manually._
17
-
18
6
### Usage
19
7
20
8
First, install the package using Yarn or npm:
@@ -29,7 +17,19 @@ or
29
17
yarn add react-app-polyfill
30
18
```
31
19
32
-
Now, you can import the entry point for the minimal version you intend to support. For example, if you import the IE9 entry point, this will include IE10 and IE11 support.
20
+
## Supporting Internet Explorer
21
+
22
+
You can import the entry point for the minimal version you intend to support to ensure that the minimum langauge features are present that are required to use Create React App. For example, if you import the IE9 entry point, this will include IE10 and IE11 support.
23
+
24
+
These modules ensure the following language features are present:
25
+
26
+
1.`Promise` (for `async` / `await` support)
27
+
1.`window.fetch` (a Promise-based way to make web requests in the browser)
28
+
1.`Object.assign` (a helper required for Object Spread, i.e. `{ ...a, ...b }`)
29
+
1.`Symbol` (a built-in object used by `for...of` syntax and friends)
30
+
1.`Array.from` (a built-in static method used by array spread, i.e. `[...arr]`)
31
+
32
+
_If you need more features, see the [Polyfilling other language features](#polyfilling-other-language-features) section below._
You can also polyfill stable language features not available in your target browsers. If you're using this in Create React App, it will automatically use the `browserslist` you've defined to only include polyfills needed by your target browsers when importing the `stable` polyfill. **Make sure to follow the Internet Explorer steps above if you need to support Internet Explorer in your application**.
55
+
56
+
```js
57
+
// This must be the first line in src/index.js
58
+
import'react-app-polyfill/stable';
59
+
60
+
// ...
61
+
```
62
+
63
+
If you are supporting Internet Explorer 9 or Internet Explorer 11 you should include both the `ie9` or `ie11` and `stable` modules:
0 commit comments