From 7c34f41ce923ff1a44516517adba05bbbfeddccf Mon Sep 17 00:00:00 2001 From: Carlos Bravo Date: Mon, 29 Apr 2024 16:25:18 +0200 Subject: [PATCH] Prevent production constant missing errors --- packages/interactivity/src/directives.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/interactivity/src/directives.js b/packages/interactivity/src/directives.js index 3bf80781057e05..b90ebbdaad63e3 100644 --- a/packages/interactivity/src/directives.js +++ b/packages/interactivity/src/directives.js @@ -242,7 +242,11 @@ export default () => { if ( defaultEntry ) { const { namespace, value } = defaultEntry; // Check that the value is a JSON object. Send a console warning if not. - if ( SCRIPT_DEBUG && ! isPlainObject( value ) ) { + if ( + typeof SCRIPT_DEBUG !== 'undefined' && + SCRIPT_DEBUG === true && + ! isPlainObject( value ) + ) { // eslint-disable-next-line no-console console.warn( `The value of data-wp-context in "${ namespace }" store must be a valid stringified JSON object.`