Make WordPress Core

Changeset 58193


Ignore:
Timestamp:
05/24/2024 07:58:42 AM (4 weeks ago)
Author:
gziolo
Message:

Build: Add globalThis DefinePlugin config to webpack

This updates the build to account for related changes in WordPress packages. More details in https://github.com/WordPress/gutenberg/pull/61486.

Props jonsurrell, youknowriad, swissspidy, gziolo.
Fixes #61262.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/webpack/shared.js

    r57499 r58193  
    4242        plugins: [
    4343            new DefinePlugin( {
     44                /*
     45                 * These variables are part of https://github.com/WordPress/gutenberg/pull/61486
     46                 * They're expected to be released in an upcoming version of Gutenberg.
     47                 *
     48                 * Defining this before the packages are released is harmless.
     49                 *
     50                 * @todo Remove the non-globalThis defines here when packages have been upgraded to the globalThis versions.
     51                 */
     52
    4453                // Inject the `IS_GUTENBERG_PLUGIN` global, used for feature flagging.
    45                 'process.env.IS_GUTENBERG_PLUGIN': false,
     54                'globalThis.IS_GUTENBERG_PLUGIN': JSON.stringify( false ),
    4655                // Inject the `IS_WORDPRESS_CORE` global, used for feature flagging.
    47                 'process.env.IS_WORDPRESS_CORE': true,
     56                'globalThis.IS_WORDPRESS_CORE': JSON.stringify( true ),
    4857                // Inject the `SCRIPT_DEBUG` global, used for dev versions of JavaScript.
    49                 SCRIPT_DEBUG: mode === 'development',
     58                'globalThis.SCRIPT_DEBUG': JSON.stringify(
     59                    mode === 'development'
     60                ),
     61
     62                // Inject the `IS_GUTENBERG_PLUGIN` global, used for feature flagging.
     63                'process.env.IS_GUTENBERG_PLUGIN': JSON.stringify( false ),
     64                // Inject the `IS_WORDPRESS_CORE` global, used for feature flagging.
     65                'process.env.IS_WORDPRESS_CORE': JSON.stringify( true ),
     66                // Inject the `SCRIPT_DEBUG` global, used for dev versions of JavaScript.
     67                SCRIPT_DEBUG: JSON.stringify( mode === 'development' ),
    5068            } ),
    5169        ],
Note: See TracChangeset for help on using the changeset viewer.