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

Addon-docs: Fix MDX components not applied in Vite and theme loading twice #25925

Merged
merged 2 commits into from
Feb 6, 2024

Conversation

JReinhold
Copy link
Contributor

@JReinhold JReinhold commented Feb 6, 2024

Fixes #25761
Fixes #25737
Fixes #24046

What I did

When a user has something else than the latest React installed, the dependencies of addon-docs will get duplicated in @storybook/addon-docs/node_modules - that's apparently just how package managers work. Therefore in that case we need to ensure that some of the dependencies are deduplicated in Vite (Webpack already does this):

  1. Deduplicated @storybook/theming and other related packages
  2. Aliased @mdx-js/react similar to react and react-dom, like we already did for Webpack. That's because multiple instances of that package would get bundled resulting in the MDXProvider being different, and thus none of the default components being available.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This pull request has been released as version 0.0.0-pr-25925-sha-38205a1c. Try it out in a new sandbox by running npx storybook@0.0.0-pr-25925-sha-38205a1c sandbox or in an existing project with npx storybook@0.0.0-pr-25925-sha-38205a1c upgrade.

More information
Published version 0.0.0-pr-25925-sha-38205a1c
Triggered by @JReinhold
Repository storybookjs/storybook
Branch jeppe/deduplicate-addon-docs-packages
Commit 38205a1c
Datetime Tue Feb 6 12:58:44 UTC 2024 (1707224324)
Workflow run 7800060641

To request a new release of this pull request, mention the @storybookjs/core team.

core team members can create a new canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=25925

@JReinhold JReinhold added the bug label Feb 6, 2024
@JReinhold JReinhold merged commit 2e7405f into next Feb 6, 2024
70 of 75 checks passed
@JReinhold JReinhold deleted the jeppe/deduplicate-addon-docs-packages branch February 6, 2024 14:12
@github-actions github-actions bot mentioned this pull request Feb 6, 2024
21 tasks
@shilman shilman changed the title Addon-docs: Fix MDX components not being applied in Vite and theming loading twice Addon-docs: Fix MDX components not applied in Vite and theming loading twice Feb 6, 2024
@shilman shilman changed the title Addon-docs: Fix MDX components not applied in Vite and theming loading twice Addon-docs: Fix MDX components not applied in Vite and theme loading twice Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants