-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Scripts: Fix multiple build runtimes conflicting when using globals #27985
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gziolo
added
[Type] Bug
An existing feature does not function as intended
[Tool] WP Scripts
/packages/scripts
labels
Jan 5, 2021
gziolo
changed the title
Scripts: Fix multiple build runtimes to conflict when using globals
Scripts: Fix multiple build runtimes conflicting when using globals
Jan 5, 2021
Size Change: 0 B Total Size: 1.28 MB ℹ️ View Unchanged
|
This was referenced Jan 5, 2021
Closed
gziolo
added a commit
that referenced
this pull request
Jan 5, 2021
…27985) * Scripts: Fix multiple build runtimes to conflict when using globals * Docs: Add changelog entry for bug fix
This was referenced Mar 17, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #23607.
Fixes #24321.
Fixes #27432.
Fixes #27969.
This PR adds the polyfill for the default behavior that was added in webpack 5. We are still on webpack 4 that had
output.jsonpFunction
field that allowed us to define a unique identifier for the build runtime.This patch prevents conflicts when multiple webpack runtimes (from different apps) are used on the same page. The only requirement is that project needs to have
package.json
defined with a unique name.How has this been tested?
This part is tricky but it's definitely possible. It has to follow CI job for Gutenberg that verifies
@wordpress/create-block
:gutenberg/bin/test-create-block.sh
Lines 25 to 32 in e389aeb
You need to create two blocks with the latest Gutenberg that don't install
@wordpress/scripts
and use the patched version of@wordpress/scripts
from this branch.Now you need to put both blocks (plugins) in the WordPress plugins directory and verify they load.
You can also verify that the unique name is used in the
build/index.js
file:Now you can confirm that both blocks can work at the same time 🎉
Types of changes
Checklist: