#61262 closed enhancement (fixed)
Build: Update JavaScript build variables for Gutenberg PR 61486
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch |
Focuses: | javascript | Cc: |
Description
PR 61486 updates the variables replaced at compile time in Gutenberg packages.
The Webpack DefinePlugin configuration should be updated accordingly.
Change History (16)
This ticket was mentioned in PR #6596 on WordPress/wordpress-develop by @jonsurrell.
11 months ago
#1
- Keywords has-patch added
@swissspidy commented on PR #6596:
11 months ago
#3
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.
@youknowriad commented on PR #6596:
11 months ago
#4
Does this mean any other projects using these packages also need to update their configs?
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.
@youknowriad commented on PR #6596:
11 months ago
#5
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)
@jonsurrell commented on PR #6596:
11 months ago
#6
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 https://github.com/WordPress/gutenberg/pull/61486)
Gutenberg does that here:
This PR is updating Core's build configuration accordingly.
@jonsurrell commented on PR #6596:
11 months ago
#7
Does this mean any other projects using these packages also need to update their configs?
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 process.env
has.
@youknowriad commented on PR #6596:
11 months ago
#8
LGTM
11 months ago
#10
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.
This ticket was mentioned in PR #6904 on WordPress/wordpress-develop by @jonsurrell.
10 months ago
#12
https://github.com/WordPress/gutenberg/pull/61486 changed the variables
compiled into Gutenberg packages via the webpack DefinePlugin.
https://core.trac.wordpress.org/changeset/58193 added the new
DefinePlugin configuration, but did not remove the legacy configuration
in order to be compatible with new and old Gutenberg versions before the
packages were updated.
Now that packages have been update, the legacy configuration should be
removed.
Closes https://core.trac.wordpress.org/ticket/61262.
Follow-up to https://core.trac.wordpress.org/changeset/58193.
Trac ticket:
@jonsurrell commented on PR #6904:
10 months ago
#13
https://github.com/WordPress/wordpress-develop/pull/6596 added the configuration.
@jonsurrell commented on PR #6596:
10 months ago
#14
https://github.com/WordPress/wordpress-develop/pull/6904 is the follow-up to remove the legacy configuration.
10 months ago
#16
Committed with https://core.trac.wordpress.org/changeset/58577.
This updates the build to account for the following PR:
https://github.com/WordPress/gutenberg/pull/61486
Trac ticket: https://core.trac.wordpress.org/ticket/61262