From a51f5c75c034fde69319898005c66e4440977ebc Mon Sep 17 00:00:00 2001 From: webmiraclepro Date: Thu, 25 Feb 2016 07:11:04 +0800 Subject: [PATCH] Add promise and fetch polyfills to build Previously we were polyfilling using webpack, which of course only affected the demo and not the actual build Fixes https://github.com/CookPete/react-player/issues/39 --- package.json | 7 ++++--- src/ReactPlayer.js | 2 ++ webpack.config.dev.js | 5 +---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 741ab3a..ce544ad 100644 --- a/package.json +++ b/package.json @@ -81,12 +81,13 @@ "style-loader": "^0.13.0", "webpack": "^1.12.9", "webpack-dev-middleware": "^1.4.0", - "webpack-hot-middleware": "^2.6.0", - "whatwg-fetch": "^0.11.0" + "webpack-hot-middleware": "^2.6.0" }, "dependencies": { + "es6-promise": "^3.1.2", "load-script": "^1.0.0", - "query-string": "^3.0.0" + "query-string": "^3.0.0", + "whatwg-fetch": "^0.11.0" }, "standard": { "parser": "babel-eslint", diff --git a/src/ReactPlayer.js b/src/ReactPlayer.js index 0d0e5f8..e6008c8 100644 --- a/src/ReactPlayer.js +++ b/src/ReactPlayer.js @@ -1,3 +1,5 @@ +import 'es6-promise' +import 'whatwg-fetch' import React, { Component } from 'react' import { propTypes, defaultProps } from './props' diff --git a/webpack.config.dev.js b/webpack.config.dev.js index 69886b3..03a4cbd 100644 --- a/webpack.config.dev.js +++ b/webpack.config.dev.js @@ -14,10 +14,7 @@ module.exports = { }, plugins: [ new webpack.HotModuleReplacementPlugin(), - new webpack.NoErrorsPlugin(), - new webpack.ProvidePlugin({ - 'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch' - }) + new webpack.NoErrorsPlugin() ], module: { loaders: [{