From c022eeded8197b86f5bb59a7e41fc40900b50e45 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Tue, 29 Oct 2024 23:35:19 +0900 Subject: [PATCH] Storybook: Log `warning()` when in dev mode --- storybook/main.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/storybook/main.js b/storybook/main.js index f111e9f5d8cd3..e482ee23c2e5f 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' + ), + } ), + ], }; }, };