From 4ff4824361d84a18b0aaa09941d6af5402452943 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Thu, 26 Sep 2019 14:00:45 -0600 Subject: [PATCH] set output.globalObject to 'this' 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,