-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop IE 11 support by default (#5090)
* Drop ie 11 support and move polyfills to a new package * More useful directions for what entry point to use #5090 (comment) * Clear up what file this polyfill goes in #5090 (comment) * Polyfill `window`, not `global` * Remove proxy polyfill file
- Loading branch information
Showing
9 changed files
with
116 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# react-app-polyfill | ||
|
||
This package includes polyfills for various browsers. | ||
It includes minimum requirements and commonly used language features used by [Create React App](https://github.com/facebook/create-react-app) projects.<br> | ||
Please refer to its documentation: | ||
|
||
- [Getting Started](https://github.com/facebook/create-react-app/blob/master/README.md#getting-started) – How to create a new app. | ||
- [User Guide](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md) – How to develop apps bootstrapped with Create React App. | ||
|
||
### Features | ||
|
||
Each polyfill ensures the following language features are present: | ||
|
||
1. `Promise` (for `async` / `await` support) | ||
1. `window.fetch` (a Promise-based way to make web requests in the browser) | ||
1. `Object.assign` (a helper required for Object Spread, i.e. `{ ...a, ...b }`) | ||
1. `Symbol` (a built-in object used by `for...of` syntax and friends) | ||
1. `Array.from` (a built-in static method used by array spread, i.e. `[...arr]`) | ||
|
||
### Entry Points | ||
|
||
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. | ||
|
||
#### Internet Explorer 9 | ||
|
||
```js | ||
// This must be the first line in src/index.js | ||
import 'react-app-polyfill/ie9'; | ||
|
||
// ... | ||
``` | ||
|
||
#### Internet Explorer 11 | ||
|
||
```js | ||
// This must be the first line in src/index.js | ||
import 'react-app-polyfill/ie11'; | ||
|
||
// ... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
'use strict'; | ||
|
||
if (typeof Promise === 'undefined') { | ||
// Rejection tracking prevents a common issue where React gets into an | ||
// inconsistent state due to an error, but it gets swallowed by a Promise, | ||
// and the user has no idea what causes React's erratic future behavior. | ||
require('promise/lib/rejection-tracking').enable(); | ||
window.Promise = require('promise/lib/es6-extensions.js'); | ||
} | ||
|
||
// fetch() polyfill for making API calls. | ||
require('whatwg-fetch'); | ||
|
||
// Object.assign() is commonly used with React. | ||
// It will use the native implementation if it's present and isn't buggy. | ||
Object.assign = require('object-assign'); | ||
|
||
// Support for...of (a commonly used syntax feature that requires Symbols) | ||
require('core-js/es6/symbol'); | ||
// Support iterable spread (...Set, ...Map) | ||
require('core-js/fn/array/from'); | ||
|
||
// React 16+ relies on Map, Set, and requestAnimationFrame | ||
require('core-js/es6/map'); | ||
require('core-js/es6/set'); | ||
require('raf').polyfill(window); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
'use strict'; | ||
|
||
// fetch() polyfill for making API calls. | ||
require('whatwg-fetch'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "react-app-polyfill", | ||
"version": "0.0.0", | ||
"description": "Polyfills for various browsers including commonly used language features", | ||
"repository": "facebook/create-react-app", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/facebook/create-react-app/issues" | ||
}, | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"files": [ | ||
"ie9.js", | ||
"ie11.js", | ||
"jsdom.js" | ||
], | ||
"dependencies": { | ||
"core-js": "2.5.7", | ||
"object-assign": "4.1.1", | ||
"promise": "8.0.2", | ||
"raf": "3.4.0", | ||
"whatwg-fetch": "3.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters