[wp-trac] [WordPress Trac] #59407: Build: Introduce SCRIPT_DEBUG global in webpack processing
WordPress Trac
noreply at wordpress.org
Wed Sep 20 12:19:14 UTC 2023
#59407: Build: Introduce SCRIPT_DEBUG global in webpack processing
---------------------------------------+-----------------------
Reporter: gziolo | Owner: gziolo
Type: enhancement | Status: assigned
Priority: normal | Milestone: 6.4
Component: Build/Test Tools | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch gutenberg-merge | Focuses:
---------------------------------------+-----------------------
Description changed by gziolo:
Old description:
> Backports the same changes to the webpack config in the Gutenberg plugin
> with https://github.com/WordPress/gutenberg/pull/50122.
>
> The `warning` from `@wordpress/warning` no longer worked correctly with
> webpack 5. In practice, it no longer called `console.warn`. To fix it,
> the usage of `process.env.NODE_ENV` check got replaced with another
> optional global: `SCRIPT_DEBUG`. All the tools used in the Gutenberg, get
> updated to work with this new constant, including `@wordpress/scripts`.
> This way, developers are able to guard code that should be run only in
> development mode. In WordPress core, the same constant needs to be added
> mostly to ensure that the code behind the check gets completely removed
> in production mode.
New description:
Backports the same changes to the webpack config in the Gutenberg plugin
with https://github.com/WordPress/gutenberg/pull/50122.
The `warning` from `@wordpress/warning` no longer worked correctly with
webpack 5. In practice, it no longer called `console.warn`. To fix it,
the usage of `process.env.NODE_ENV` check got replaced with another
optional global: `SCRIPT_DEBUG`. All the tools used in the Gutenberg, get
updated to work with this new constant, including `@wordpress/scripts`.
This way, developers are able to guard code that should be run only in
development mode. In WordPress core, the same constant needs to be added
mostly to ensure that the code behind the check gets completely removed in
production mode.
It's an enhancement on top of #59411 and can be tested after WordPress
packages get backported from the Gutenberg plugin.
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59407#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list