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

fix(storybook-builder): fix providerImportSource extension when using @storybook/addon-essentials #2703

Merged

Conversation

bashmish
Copy link
Member

@bashmish bashmish commented Apr 17, 2024

What I did

  1. Fixed issue when an MDX file is compiled with a wrong module path ("./../../../node_modules/@storybook/addon-docs/dist/shims/mdx-react-shim") without an extension, which is coming from @storybook/addon-essentials https://github.com/storybookjs/storybook/blob/v7.6.17/code/addons/essentials/src/docs/preset.ts#L10
/*@jsxRuntime automatic @jsxImportSource react*/
import {Fragment as _Fragment, jsxDEV as _jsxDEV} from "./../../../node_modules/.prebundled_modules/react/jsx-dev-runtime.mjs";


import {
  useMDXComponents as _provideComponents
} from "./../../../node_modules/@storybook/addon-docs/dist/shims/mdx-react-shim"; // this is a bug


function _createMdxContent(props) {
  const _components = Object.assign({
    h1: "h1",
    p: "p",
    code: "code",
    pre: "pre"
  }, _provideComponents(), props.components);

I didn't catch this bug here, because wds-outside-root happens to add an extension when I run tests in a monorepo. But it doesn't happen in simple repos where wds-outside-root is not used. Not sure how to improve tests in such a way that it happens here, the risk is if I do more like in a simple repo, then the monorepo setup won't be tested. So I'll keep things as is, especially given it's such a weird and rare bug.

I'll try to fix it in the Storybook too, but it takes time, older version should work too since we start to migraate users and I'm not sure it's gonna be backported to Storybook 7 which we need to support for now: storybookjs/storybook#26868

Copy link

changeset-bot bot commented Apr 17, 2024

🦋 Changeset detected

Latest commit: 7b11064

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@web/storybook-builder Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@bashmish bashmish merged commit 691afb0 into master Apr 17, 2024
6 of 7 checks passed
@bashmish bashmish deleted the fix/storybook-builder-providerImportSource-extension branch April 17, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant