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
1 parent 13c79db commit 6c4d9a3
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.0.15",
"@storybook/core-common": "7.0.15",
"@storybook/csf-plugin": "7.0.15",
"@storybook/global": "^5.0.0",
"@storybook/mdx2-csf": "^1.0.0",
"@storybook/node-logger": "7.0.15",
"@storybook/preview": "7.0.15",
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 @@ -5567,7 +5567,6 @@ __metadata:
"@storybook/client-logger": 7.0.15
"@storybook/core-common": 7.0.15
"@storybook/csf-plugin": 7.0.15
"@storybook/global": ^5.0.0
"@storybook/mdx2-csf": ^1.0.0
"@storybook/node-logger": 7.0.15
"@storybook/preview": 7.0.15
Expand Down

0 comments on commit 6c4d9a3

Please sign in to comment.