-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
calypso-build: add webpack config for output.jsonpFunction #46252
Conversation
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! 👍
@@ -54,6 +54,7 @@ function getWebpackConfig( | |||
'output-path': outputPath = path.join( process.cwd(), 'dist' ), | |||
'output-filename': outputFilename = '[name].js', | |||
'output-library-target': outputLibraryTarget = 'window', | |||
'output-jsonp-function': outputJsonpFunction = 'webpackJsonp', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also add a line to the docblock comment few lines above? The existing documentation there is not terribly helpful though 🙁 (output-path
sets output path and output-library-target
sets output library target, who would have guessed that)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Done in b42eaaa
@creativecoder We usually do the release chores (changelog, version bump) as a separate PR. There is a P2 post about how to publish packages to NPM (with a video!) here: p4TIVU-9mL-p2. The NPM publishing docs in the Calypso repo also look reasonably up to date. |
Changes proposed in this Pull Request
The webpack docs state
This seems to be a source of WordPress plugin conflicts, when multiple plugins use webpack to build js. For example: Automattic/jetpack#17289
Adding this config allows plugins that use calypso-build's webpack config, like Jetpack, to customize the webpack jsonp global variable name and avoid these conflicts.
Note that this config is changing to
chunkLoadingGlobal
in webpack 5, so we might want to address that in some way, as well.Testing instructions
output-jsonp-function
to a webpack build process that usesgetWebpackConfig
from calypso-build (Jetpack example: Automattic/jetpack@33815b4)window["webpackJsonp"]
uses what you specified for the global variableRequired for fixing Automattic/jetpack#17289