Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite: Fix pnpm support by replacing @storybook/global with window #22709

Merged
merged 1 commit into from
May 24, 2023

Conversation

IanVS
Copy link
Member

@IanVS IanVS commented May 23, 2023

Closes #22695

What I did

If we want to use @storybook/global in a virtual module in the vite builder, we'd need to add it to the runtime bundle in order to support pnpm users. Since this is purely preview code, though, we can just use window and avoid the dep entirely.

How to test

Create a pnpm project, add storybook, swap in this change, confirm that stories load. I did that in my own pnpm project and it works well now on 7.0.15.

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

@shilman shilman changed the title Vite: replace @storybook/global with window Vite: Fix pnpm support by replacing @storybook/global with window May 24, 2023
@shilman shilman merged commit 3eb2d74 into next May 24, 2023
@shilman shilman deleted the vite/global-window branch May 24, 2023 00:07
@shilman shilman added the patch:yes Bugfix & documentation PR that need to be picked to main branch label May 24, 2023
shilman added a commit that referenced this pull request May 24, 2023
Vite: Fix pnpm support by replacing @storybook/global with `window`
@shilman shilman mentioned this pull request May 24, 2023
@shilman shilman added the patch:done Patch/release PRs already cherry-picked to main/release branch label May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug builder-vite patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch pnpm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: PNPM/Vite Failed to resolve import "@storybook/global"
2 participants