Make WordPress Core

Opened 3 years ago

Closed 2 years ago

#55017 closed task (blessed) (fixed)

Remove GUTENBERG_PHASE configuration from webpack

Reported by: talldanwp's profile talldanwp Owned by: talldanwp's profile talldanwp
Milestone: 6.0 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch
Focuses: Cc:

Description (last modified by talldanwp)

The Gutenberg repo has been using a GUTENBERG_PHASE environment variable for a while to feature flag particular features (mostly experimental blocks).

When the packages from Gutenberg are compiled by webpack in core, the idea is that this feature flagged code is removed from the build via webpack's dead code elimination feature.

The variable was set to an integer representing the phases of Gutenberg (core set to 1 and gutenberg set to 2), so that when the project moves to a new phase the value is incremented. That didn't really turn out to be a useful approach though.

Recently in the Gutenberg project this variable was renamed to IS_GUTENBERG_PLUGIN and changed to a boolean (https://github.com/WordPress/gutenberg/pull/38202).

It should now be possible to remove this configuration from WordPress core and rely on the falseyness of it being undefined.

Here are the details of what needs to be removed:
https://github.com/WordPress/wordpress-develop/search?q=GUTENBERG_PHASE

Change History (9)

#1 @talldanwp
3 years ago

  • Owner set to talldanwp
  • Status changed from new to assigned

#2 @talldanwp
3 years ago

  • Description modified (diff)

This ticket was mentioned in PR #2255 on WordPress/wordpress-develop by talldan.


3 years ago
#3

  • Keywords has-patch added; needs-patch removed

Removes the GUTENBERG_PHASE configuration that was previously used to remove feature flagged gutenberg code. The way this works has changed in the Gutenberg codebase (see https://github.com/WordPress/gutenberg/pull/38202). The variable is now called IS_GUTENBERG_PLUGIN and is a boolean value.

It should be fine to remove this configuration as setting it to false would have the same result in it not being present, given undefined is also a falsey value.

Trac ticket: 55017

talldan commented on PR #2255:


3 years ago
#4

I'm not sure how to fix the Test NPM failure on CI, if anyone has advice that would be very much appreciated 😄

walbo commented on PR #2255:


3 years ago
#5

Running npm run build:dev should generate an updated script-loader-packages.php file.

talldan commented on PR #2255:


3 years ago
#6

Thanks, that's now updated 👍

gziolo commented on PR #2255:


2 years ago
#7

I didn’t notice this PR before. We replaced this constant with the new one used in Gutenberg. See https://github.com/WordPress/wordpress-develop/commit/bab610091d59f6dd21c7db84ba3e1ca0bab6a211. Should we skip it altogether in WordPress core insteas?

talldan commented on PR #2255:


2 years ago
#8

@gziolo I think it's fine either way. Easiest option is for me to close this PR now 😄

Thanks for removing the old configuration. 🙇

#9 @talldanwp
2 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

As mentioned in the previous comments, this should be resolved, so I'm closing the ticket.

Note: See TracTickets for help on using tickets.