From 73c902db2e4508aae85d470fb68e6c96d0112286 Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Tue, 23 May 2023 15:19:46 -0400 Subject: [PATCH] Vite: replace @storybook/global with `window` --- code/lib/builder-vite/package.json | 1 - code/lib/builder-vite/src/codegen-set-addon-channel.ts | 3 +-- code/yarn.lock | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/code/lib/builder-vite/package.json b/code/lib/builder-vite/package.json index b707006f46e6..7ffb95906044 100644 --- a/code/lib/builder-vite/package.json +++ b/code/lib/builder-vite/package.json @@ -47,7 +47,6 @@ "@storybook/client-logger": "7.1.0-alpha.21", "@storybook/core-common": "7.1.0-alpha.21", "@storybook/csf-plugin": "7.1.0-alpha.21", - "@storybook/global": "^5.0.0", "@storybook/mdx2-csf": "^1.0.0", "@storybook/node-logger": "7.1.0-alpha.21", "@storybook/preview": "7.1.0-alpha.21", diff --git a/code/lib/builder-vite/src/codegen-set-addon-channel.ts b/code/lib/builder-vite/src/codegen-set-addon-channel.ts index 8e706cb6ae2e..aa866408415d 100644 --- a/code/lib/builder-vite/src/codegen-set-addon-channel.ts +++ b/code/lib/builder-vite/src/codegen-set-addon-channel.ts @@ -1,6 +1,5 @@ export async function generateAddonSetupCode() { return ` - import { global } from '@storybook/global'; import { createChannel as createPostMessageChannel } from '@storybook/channel-postmessage'; import { createChannel as createWebSocketChannel } from '@storybook/channel-websocket'; import { addons } from '@storybook/preview-api'; @@ -9,7 +8,7 @@ export async function generateAddonSetupCode() { addons.setChannel(channel); window.__STORYBOOK_ADDONS_CHANNEL__ = channel; - if (global.CONFIG_TYPE === 'DEVELOPMENT'){ + if (window.CONFIG_TYPE === 'DEVELOPMENT'){ const serverChannel = createWebSocketChannel({}); addons.setServerChannel(serverChannel); window.__STORYBOOK_SERVER_CHANNEL__ = serverChannel; diff --git a/code/yarn.lock b/code/yarn.lock index 38889173c1e4..a7a3b8ba221d 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -5550,7 +5550,6 @@ __metadata: "@storybook/client-logger": 7.1.0-alpha.21 "@storybook/core-common": 7.1.0-alpha.21 "@storybook/csf-plugin": 7.1.0-alpha.21 - "@storybook/global": ^5.0.0 "@storybook/mdx2-csf": ^1.0.0 "@storybook/node-logger": 7.1.0-alpha.21 "@storybook/preview": 7.1.0-alpha.21