-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Build: Add globalThis DefinePlugin config to webpack #6596
Conversation
This updates the build to account for the following PR: WordPress/gutenberg#61486
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Trac Ticket MissingThis pull request is missing a link to a Trac ticket. For a contribution to be considered, there must be a corresponding ticket in Trac. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. More information about contributing to WordPress on GitHub can be found in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
I‘m confused, why does this require a core change? Does this mean any other projects using these packages also need to update their configs? I thought those variables in the GB packages are replaced during compile time for dead code elimination and shouldn‘t be present in the distributed packages. |
I think it's not mandatory and these values would act as "false" by default but if you want to tree-shake them out of the code base, it's better to update the config. |
The variables are present in the packages (just like the previous ones were) to allow the folks importing the packages (Gutenberg or Core) to decide whether to enable something or not (disabled by default) |
The variables are replaced when they're compiled as Core Scripts or Script Modules. They're shipped in the npm packages (that has not changed at all with WordPress/gutenberg#61486). Gutenberg does that here: This PR is updating Core's build configuration accordingly. |
Yes and no. If folks are actually compiling projects with the npm packages (bundled, not provided by WordPress) and had configured their bundler to perform replacements then they'd need to update. I believe those are very exceptional conditions. There shouldn't be anything harmful about this change for most projects, in fact it's safer as it should remove some of the problems that |
LGTM |
Committed with https://core.trac.wordpress.org/changeset/58193. We will have to follow up with the removal of old replacements when the next version of WP packages gets published to npm. |
#6904 is the follow-up to remove the legacy configuration. |
This updates the build to account for the following PR:
WordPress/gutenberg#61486
This affects the build of JavaScript packages to ensure dead-code elimination works correctly.
It should be harmless to land this PR before packages are updated. The older configuration can be removed after the packages are updated.
Trac ticket: https://core.trac.wordpress.org/ticket/61262
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.