From 8fded1802b1289e212c6ef6d9d015e3587253e94 Mon Sep 17 00:00:00 2001 From: mzabriskie Date: Tue, 10 Mar 2015 14:30:49 -0600 Subject: [PATCH] Fixing issue with standalone build closes #47 --- lib/axios.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/axios.js b/lib/axios.js index 0e92518..4e2847a 100644 --- a/lib/axios.js +++ b/lib/axios.js @@ -5,7 +5,14 @@ var dispatchRequest = require('./core/dispatchRequest'); var InterceptorManager = require('./core/InterceptorManager'); // Polyfill ES6 Promise if needed -require('es6-promise').polyfill(); +(function () { + // webpack is being used to set es6-promise to the native Promise + // for the standalone build. It's necessary to make sure polyfill exists. + var P = require('es6-promise'); + if (P && typeof P.polyfill === 'function') { + P.polyfill(); + } +})(); var axios = module.exports = function axios(config) { config = utils.merge({