Skip to content

Commit 81a71cf

Browse files
sibiraj-smrmckeb
authored andcommitted
Set jsonpFunction to prevent conflicts (facebook#5951)
1 parent b612a16 commit 81a71cf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

config/webpack.config.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
3939
// @remove-on-eject-end
4040
const postcssNormalize = require('postcss-normalize');
4141

42+
const appPackageJson = require(paths.appPackageJson);
43+
4244
// Source maps are resource heavy and can cause out of memory issue for large source files.
4345
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
4446
// Some apps do not need the benefits of saving a web request, so not inlining the chunk
@@ -189,6 +191,9 @@ module.exports = function(webpackEnv) {
189191
.replace(/\\/g, '/')
190192
: isEnvDevelopment &&
191193
(info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
194+
// Prevents conflicts when multiple Webpack runtimes (from different apps)
195+
// are used on the same page.
196+
jsonpFunction: `webpackJsonp${appPackageJson.name}`,
192197
},
193198
optimization: {
194199
minimize: isEnvProduction,
@@ -197,7 +202,7 @@ module.exports = function(webpackEnv) {
197202
new TerserPlugin({
198203
terserOptions: {
199204
parse: {
200-
// we want terser to parse ecma 8 code. However, we don't want it
205+
// We want terser to parse ecma 8 code. However, we don't want it
201206
// to apply any minification steps that turns valid ecma 5 code
202207
// into invalid ecma 5 code. This is why the 'compress' and 'output'
203208
// sections only apply transformations that are ecma 5 safe

0 commit comments

Comments
 (0)