Skip to content

Commit

Permalink
Prevent production constant missing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
cbravobernal committed Apr 29, 2024
1 parent 1981603 commit 7c34f41
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/interactivity/src/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.`
Expand Down

0 comments on commit 7c34f41

Please sign in to comment.