Skip to content

Commit

Permalink
Storybook: Log warning() when in dev mode (WordPress#66568)
Browse files Browse the repository at this point in the history
Co-authored-by: mirka <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
3 people authored and karthick-murugan committed Nov 13, 2024
1 parent a8abe7b commit e9521b5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* External dependencies
*/
const path = require( 'path' );
const DefinePlugin = require( 'webpack' ).DefinePlugin;

/**
* WordPress dependencies
Expand Down Expand Up @@ -107,6 +108,15 @@ module.exports = {
},
],
},
plugins: [
...config.plugins,
new DefinePlugin( {
// Ensures that `@wordpress/warning` can properly detect dev mode.
'globalThis.SCRIPT_DEBUG': JSON.stringify(
process.env.NODE_ENV === 'development'
),
} ),
],
};
},
};

0 comments on commit e9521b5

Please sign in to comment.