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

[Bug] Error: [vite-plugin-mdx] "@mdx-js/preact" must be installed #406

Closed
1 task done
MichaelBitard opened this issue Jun 7, 2022 · 7 comments
Closed
1 task done
Labels
bug Something isn't working has workaround

Comments

@MichaelBitard
Copy link

What version of vite are you using?

0.1.36

System info and storybook versions

System:
OS: Linux 5.17 Fedora Linux 36 (Workstation Edition)
CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Binaries:
Node: 17.8.0 - /opt/tools/node/bin/node
Yarn: 1.22.18 - /opt/tools/node/bin/yarn
npm: 8.9.0 - /opt/clients/camino/camino/node_modules/.bin/npm
Browsers:
Chrome: 101.0.4951.64
Firefox: 100.0

Describe the Bug

I think this transitive dependency is problematic, because I don't even use mdx for my storybooks.

I have to install it manually

Link to Minimal Reproducible Example

No response

Participation

  • I am willing to submit a pull request for this issue.
@MichaelBitard MichaelBitard added the bug Something isn't working label Jun 7, 2022
@IanVS
Copy link
Member

IanVS commented Jun 7, 2022

This looks to be related to #391. Unfortunately we're in a transitional period with mdx1 and mdx2, and still finding a good way to support them both. The workaround of installing the package manually is your best bet for now.

@giannif
Copy link

giannif commented Jun 14, 2022

I'm having this issue because in my monorepo (yarn workspace + turbo) one of my packages uses a package that has preact, that makes it try to require @mdx-js/preact, even though my storybook is all React components.

If I remove all references to Preact from my monorepo, everything works.

I think here is where that decision is made

Can there be a configuration option to override that?

@IanVS
Copy link
Member

IanVS commented Jun 14, 2022

Hmmmm, @giannif could you try using nohoist to keep preact inside the package which uses it, rather than hoisting it up to the top-level node_modules?

@giannif
Copy link

giannif commented Jun 14, 2022

@IanVS great idea, works, thanks!

@MichaelBitard
Copy link
Author

Is there a way to disable mdx support at the dependency level? We don't plan to use it anyway

@IanVS
Copy link
Member

IanVS commented Jun 15, 2022

Sorry, I don't know of a way to avoid installing mdx dependencies. It's baked into storybook for use in the docs pages that are automatically generated. Feel free to suggest it in the storybook repo or the discord though! Maybe there's a chance to decouple it in 7.0, although I haven't heard of any such efforts.

@MichaelBitard
Copy link
Author

Thanks, I'll close this issue for now since there is a workaround already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has workaround
Projects
None yet
Development

No branches or pull requests

3 participants