-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drop IE 11 support by default #5090
Changes from 1 commit
76f1e0a
3264f46
2eb00ad
f9f7077
681fb5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
|
||
There is no single entry point. You can only import individual browser support levels. | ||
|
||
#### Internet Explorer 9 | ||
|
||
```js | ||
// # index.js | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Maybe
|
||
import 'react-app-polyfill/ie9'; // make this the first line of your application | ||
|
||
// ... | ||
``` | ||
|
||
#### Internet Explorer 11 | ||
|
||
```js | ||
// # index.js | ||
import 'react-app-polyfill/ie11'; // make this the first line of your application | ||
|
||
// ... | ||
``` |
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(global); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. D'oh! |
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'); |
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" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// @remove-on-eject-begin | ||
/** | ||
* Copyright (c) 2014-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. | ||
*/ | ||
// @remove-on-eject-end | ||
'use strict'; | ||
|
||
require('react-app-polyfill/jsdom'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ module.exports = (resolve, rootDir, isEjecting) => { | |
// in Jest configs. We need help from somebody with Windows to determine this. | ||
const config = { | ||
collectCoverageFrom: ['src/**/*.{js,jsx}'], | ||
setupFiles: [resolve('config/polyfills.js')], | ||
setupFiles: [resolve('config/jest/polyfills.js')], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. Though, this might be a good default for people who eject so they have a location to easily add new polyfills required for tests. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And if we do switch this, does it need to be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
At this point they might as well change the config directly.
Check Jest docs? I would expect it to be smart enough to resolve it somehow. |
||
setupTestFrameworkScriptFile: setupTestsFile, | ||
testMatch: [ | ||
'<rootDir>/src/**/__tests__/**/*.{js,jsx}', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.