mirror of
git://develop.git.wordpress.org/
synced 2025-01-29 10:38:22 +01:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@58193 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2ac22f0efe
commit
93f36a09fe
@ -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.
|
||||
'process.env.IS_GUTENBERG_PLUGIN': false,
|
||||
'globalThis.IS_GUTENBERG_PLUGIN': JSON.stringify( false ),
|
||||
// Inject the `IS_WORDPRESS_CORE` global, used for feature flagging.
|
||||
'process.env.IS_WORDPRESS_CORE': true,
|
||||
'globalThis.IS_WORDPRESS_CORE': JSON.stringify( true ),
|
||||
// Inject the `SCRIPT_DEBUG` global, used for dev versions of JavaScript.
|
||||
SCRIPT_DEBUG: mode === 'development',
|
||||
'globalThis.SCRIPT_DEBUG': JSON.stringify(
|
||||
mode === 'development'
|
||||
),
|
||||
|
||||
// Inject the `IS_GUTENBERG_PLUGIN` global, used for feature flagging.
|
||||
'process.env.IS_GUTENBERG_PLUGIN': JSON.stringify( false ),
|
||||
// Inject the `IS_WORDPRESS_CORE` global, used for feature flagging.
|
||||
'process.env.IS_WORDPRESS_CORE': JSON.stringify( true ),
|
||||
// Inject the `SCRIPT_DEBUG` global, used for dev versions of JavaScript.
|
||||
SCRIPT_DEBUG: JSON.stringify( mode === 'development' ),
|
||||
} ),
|
||||
],
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user