From 42ee7212d255fd5aa6085fa03c7f0a5bfc2ac4b7 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Thu, 26 Sep 2019 16:24:48 -0600 Subject: [PATCH] set output.globalObject to 'this' (#7742) Closes #7741 --- packages/react-scripts/config/webpack.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index 62f7b0c41b4..f60a1ed06fa 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -202,6 +202,9 @@ module.exports = function(webpackEnv) { // Prevents conflicts when multiple Webpack runtimes (from different apps) // are used on the same page. jsonpFunction: `webpackJsonp${appPackageJson.name}`, + // this defaults to 'window', but by setting it to 'this' then + // module chunks which are built will work in web workers as well. + globalObject: 'this', }, optimization: { minimize: isEnvProduction,