Commit 6d7741e8 authored by Dan Abramov's avatar Dan Abramov Committed by GitHub
Browse files

Add Promise and fetch polyfills (#235)

parent 3a1ed7a9
Showing with 18 additions and 2 deletions
+18 -2
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');
}
require('whatwg-fetch');
...@@ -18,6 +18,7 @@ module.exports = { ...@@ -18,6 +18,7 @@ module.exports = {
entry: [ entry: [
require.resolve('webpack-dev-server/client') + '?http://localhost:3000', require.resolve('webpack-dev-server/client') + '?http://localhost:3000',
require.resolve('webpack/hot/dev-server'), require.resolve('webpack/hot/dev-server'),
require.resolve('./polyfills'),
path.join(paths.appSrc, 'index') path.join(paths.appSrc, 'index')
], ],
output: { output: {
......
...@@ -25,7 +25,10 @@ if (!publicPath.endsWith('/')) { ...@@ -25,7 +25,10 @@ if (!publicPath.endsWith('/')) {
module.exports = { module.exports = {
bail: true, bail: true,
devtool: 'source-map', devtool: 'source-map',
entry: path.join(paths.appSrc, 'index'), entry: [
require.resolve('./polyfills'),
path.join(paths.appSrc, 'index')
],
output: { output: {
path: paths.appBuild, path: paths.appBuild,
filename: '[name].[chunkhash:8].js', filename: '[name].[chunkhash:8].js',
......
...@@ -53,11 +53,13 @@ ...@@ -53,11 +53,13 @@
"json-loader": "0.5.4", "json-loader": "0.5.4",
"opn": "4.0.2", "opn": "4.0.2",
"postcss-loader": "0.9.1", "postcss-loader": "0.9.1",
"promise": "7.1.1",
"rimraf": "2.5.3", "rimraf": "2.5.3",
"style-loader": "0.13.1", "style-loader": "0.13.1",
"url-loader": "0.5.7", "url-loader": "0.5.7",
"webpack": "1.13.1", "webpack": "1.13.1",
"webpack-dev-server": "1.14.1" "webpack-dev-server": "1.14.1",
"whatwg-fetch": "1.0.0"
}, },
"devDependencies": { "devDependencies": {
"bundle-deps": "1.0.0", "bundle-deps": "1.0.0",
......
...@@ -47,6 +47,7 @@ prompt('Are you sure you want to eject? This action is permanent. [y/N]', functi ...@@ -47,6 +47,7 @@ prompt('Are you sure you want to eject? This action is permanent. [y/N]', functi
path.join('config', 'flow', 'file.js.flow'), path.join('config', 'flow', 'file.js.flow'),
path.join('config', 'eslint.js'), path.join('config', 'eslint.js'),
path.join('config', 'paths.js'), path.join('config', 'paths.js'),
path.join('config', 'polyfills.js'),
path.join('config', 'webpack.config.dev.js'), path.join('config', 'webpack.config.dev.js'),
path.join('config', 'webpack.config.prod.js'), path.join('config', 'webpack.config.prod.js'),
path.join('scripts', 'build.js'), path.join('scripts', 'build.js'),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment