Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build: Add globalThis DefinePlugin config to webpack #6596

Closed
Closed
Changes from 1 commit
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
20 changes: 20 additions & 0 deletions tools/webpack/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ 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(
Boolean( process.env.npm_package_config_IS_GUTENBERG_PLUGIN )
sirreal marked this conversation as resolved.
Show resolved Hide resolved
),
// Inject the `IS_WORDPRESS_CORE` global, used for feature flagging.
'globalThis.IS_WORDPRESS_CORE': JSON.stringify(
Boolean( process.env.npm_package_config_IS_WORDPRESS_CORE )
),
// Inject the `SCRIPT_DEBUG` global, used for dev versions of JavaScript.
'globalThis.SCRIPT_DEBUG': JSON.stringify( mode === 'development' ),
youknowriad marked this conversation as resolved.
Show resolved Hide resolved

// Inject the `IS_GUTENBERG_PLUGIN` global, used for feature flagging.
'process.env.IS_GUTENBERG_PLUGIN': false,
// Inject the `IS_WORDPRESS_CORE` global, used for feature flagging.
Expand Down
Loading