diff --git a/common/changes/@rushstack/heft-storybook-plugin/copilot-update-heft-storybook-plugin_2026-03-12-02-22.json b/common/changes/@rushstack/heft-storybook-plugin/copilot-update-heft-storybook-plugin_2026-03-12-02-22.json new file mode 100644 index 00000000000..c5c5e2f8ba1 --- /dev/null +++ b/common/changes/@rushstack/heft-storybook-plugin/copilot-update-heft-storybook-plugin_2026-03-12-02-22.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@rushstack/heft-storybook-plugin", + "comment": "Add `disableTelemetry` option to set STORYBOOK_DISABLE_TELEMETRY=1 when invoking Storybook; always set COREPACK_ENABLE_AUTO_PIN=0 in the subprocess environment", + "type": "minor" + } + ], + "packageName": "@rushstack/heft-storybook-plugin" +} diff --git a/heft-plugins/heft-storybook-plugin/src/StorybookPlugin.ts b/heft-plugins/heft-storybook-plugin/src/StorybookPlugin.ts index 4b3939ac429..020568192f0 100644 --- a/heft-plugins/heft-storybook-plugin/src/StorybookPlugin.ts +++ b/heft-plugins/heft-storybook-plugin/src/StorybookPlugin.ts @@ -158,6 +158,12 @@ export interface IStorybookPluginOptions { * Specifies whether to capture the webpack stats for the storybook build by adding the `--webpack-stats-json` CLI flag. */ captureWebpackStats?: boolean; + + /** + * If true, sets the `STORYBOOK_DISABLE_TELEMETRY=1` environment variable when invoking the Storybook subprocess, + * which disables Storybook's telemetry data collection. + */ + disableTelemetry?: boolean; } interface IRunStorybookOptions extends IPrepareStorybookOptions { @@ -499,6 +505,15 @@ export default class StorybookPlugin implements IHeftTaskPlugin { return await new Promise((resolve, reject) => { - const storybookEnv: NodeJS.ProcessEnv = { ...process.env }; const forkedProcess: child_process.ChildProcess = child_process.fork(command, args, { execArgv: process.execArgv, cwd, stdio: ['ignore', 'pipe', 'pipe', 'ipc'], - env: storybookEnv, + env, ...SubprocessTerminator.RECOMMENDED_OPTIONS }); @@ -587,6 +603,7 @@ export default class StorybookPlugin implements IHeftTaskPlugin