From d1bac49ee067443f175f028f1e7e532661a6ef30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Szyma=C5=84ski?= Date: Thu, 16 Sep 2021 21:08:40 +0200 Subject: [PATCH] Add globalObject: 'this' to webpack config (#3176) This should solve the issue of undefined `this` when importing from an ES6 module. I've put steps to reproduce in [this comment](https://github.com/axios/axios/issues/1861#issuecomment-669832435). Co-authored-by: Jay --- webpack.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index 9dba880a72..69e0323fdb 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -11,7 +11,8 @@ function generateConfig(name) { filename: name + '.js', sourceMapFilename: name + '.map', library: 'axios', - libraryTarget: 'umd' + libraryTarget: 'umd', + globalObject: 'this' }, node: { process: false