Skip to content

Commit

Permalink
Merge pull request #22709 from storybookjs/vite/global-window
Browse files Browse the repository at this point in the history
Vite: Fix pnpm support by replacing @storybook/global with `window`
  • Loading branch information
shilman committed May 24, 2023
2 parents 3038c8f + 73c902d commit 3eb2d74
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion code/lib/builder-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions code/lib/builder-vite/src/codegen-set-addon-channel.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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;
Expand Down
1 change: 0 additions & 1 deletion code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3eb2d74

Please sign in to comment.