window.fetch polyfill

This commit is contained in:
SleepWalker
2016-02-13 11:06:17 +02:00
parent e2598883f7
commit 19eec8f7a4
2 changed files with 9 additions and 2 deletions

View File

@@ -28,7 +28,8 @@
"react-router": "^2.0.0-rc5", "react-router": "^2.0.0-rc5",
"react-router-redux": "^2.1.0", "react-router-redux": "^2.1.0",
"redux": "^3.0.4", "redux": "^3.0.4",
"redux-thunk": "^1.0.0" "redux-thunk": "^1.0.0",
"whatwg-fetch": "^0.11.0"
}, },
"devDependencies": { "devDependencies": {
"babel-core": "^6.0.0", "babel-core": "^6.0.0",
@@ -47,9 +48,10 @@
"cssnano": "^3.4.0", "cssnano": "^3.4.0",
"eslint": "^1.10.3", "eslint": "^1.10.3",
"eslint-plugin-react": "^3.13.1", "eslint-plugin-react": "^3.13.1",
"exports-loader": "^0.6.3",
"extract-text-webpack-plugin": "^0.9.1", "extract-text-webpack-plugin": "^0.9.1",
"html-webpack-plugin": "^1.7.0", "html-webpack-plugin": "^1.7.0",
"imports-loader": "^0.6.4", "imports-loader": "^0.6.5",
"karma": "*", "karma": "*",
"karma-chai": "*", "karma-chai": "*",
"karma-es5-shim": "*", "karma-es5-shim": "*",

View File

@@ -45,6 +45,7 @@ var webpackConfig = {
app: path.join(__dirname, 'src'), app: path.join(__dirname, 'src'),
vendor: [ vendor: [
'babel-polyfill', 'babel-polyfill',
'whatwg-fetch',
'classnames', 'classnames',
'history', 'history',
'intl-format-cache', 'intl-format-cache',
@@ -111,6 +112,10 @@ var webpackConfig = {
minify: { minify: {
collapseWhitespace: isProduction collapseWhitespace: isProduction
} }
}),
new webpack.ProvidePlugin({
// window.fetch polyfill
fetch: 'imports?this=>self!exports?self.fetch!whatwg-fetch'
}) })
].concat(isTest ? [] : [ ].concat(isTest ? [] : [
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js') new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js')