Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions tools/webpack/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,30 @@ const getBaseConfig = ( env ) => {
watch: env.watch,
plugins: [
new DefinePlugin( {
/*
* These variables are part of https://github.com/WordPress/gutenberg/pull/61486
* They're expected to be released in an upcoming version of Gutenberg.
*
* Defining this before the packages are released is harmless.
*
* @todo Remove the non-globalThis defines here when packages have been upgraded to the globalThis versions.
*/

// Inject the `IS_GUTENBERG_PLUGIN` global, used for feature flagging.
'globalThis.IS_GUTENBERG_PLUGIN': JSON.stringify( false ),
// Inject the `IS_WORDPRESS_CORE` global, used for feature flagging.
'globalThis.IS_WORDPRESS_CORE': JSON.stringify( true ),
// Inject the `SCRIPT_DEBUG` global, used for dev versions of JavaScript.
'globalThis.SCRIPT_DEBUG': JSON.stringify(
mode === 'development'
),

// Inject the `IS_GUTENBERG_PLUGIN` global, used for feature flagging.
'process.env.IS_GUTENBERG_PLUGIN': false,
'process.env.IS_GUTENBERG_PLUGIN': JSON.stringify( false ),
// Inject the `IS_WORDPRESS_CORE` global, used for feature flagging.
'process.env.IS_WORDPRESS_CORE': true,
'process.env.IS_WORDPRESS_CORE': JSON.stringify( true ),
// Inject the `SCRIPT_DEBUG` global, used for dev versions of JavaScript.
SCRIPT_DEBUG: mode === 'development',
SCRIPT_DEBUG: JSON.stringify( mode === 'development' ),
} ),
],
};
Expand Down