From 355dfd522f3f74c578fb813d95463943274074a2 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Wed, 30 Oct 2024 23:32:21 +0900 Subject: [PATCH] Storybook: Log `warning()` when in dev mode (#66568) Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: tyxla --- storybook/main.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/storybook/main.js b/storybook/main.js index f111e9f5d8cd38..e482ee23c2e5fc 100644 --- a/storybook/main.js +++ b/storybook/main.js @@ -2,6 +2,7 @@ * External dependencies */ const path = require( 'path' ); +const DefinePlugin = require( 'webpack' ).DefinePlugin; /** * WordPress dependencies @@ -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' + ), + } ), + ], }; }, };