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
Pnpm: Missing typescript peer dependency in a Vite/JS project #20179
Comments
Make this optional! |
The typescript issue is tricky. One reason we're seeing it is that the typescript docgen plugin is used by default, so it's always installed, and just not used in some cases (e.g. when the project isn't using typescript). But it has a peer dependency on typescript, causing this warning. I've talked with @joshwooding about it in the past, and we're not sure how we can solve this. |
@IanVS if builder-vite, had a peerDependency on |
I'm not sure, and I don't really know how to test the theory... I'd be surprised if it works, but stranger things have happened. |
Yo-ho-ho!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.7 containing PR #20231 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
No dice.
|
ok, so
|
The tricky thing about that is that the plugin won't work if typescript isn't installed (in theory it's useful for more than just storybook), so it's not really optional as far as that package is concerned... Maybe it needs to be a But maybe it's fine to make optional, and maybe add an error message if it's not installed when it tries to run? |
It could do a runtime check? And do a no-op if it's not there? I understand that that's not great from a single unit perspective, but would make it usable in the larger ecosystem I could make a fork if that's what it takes? We need A strategy, right now we have none. |
I opened a PR joshwooding/vite-plugin-react-docgen-typescript#8 I'm not sure the code is good, I'm not sure anyone will like it, but it does proof it's technically possible, to make the plugin depend on typescript optionally and not fail hard when it's missing. |
I'll re-open this issue, to track the progress on the vite-builder > typescript peer dep problem |
Ooh-la-la!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.13 containing PR #20328 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
Getting the below warning with v7.0.0-beta.13 release, when I do npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @joshwooding/vite-plugin-react-docgen-typescript@0.0.0-20221218231544
npm WARN Found: vite@4.0.2
npm WARN node_modules/vite
npm WARN dev vite@"^4.0.1" from the root project
npm WARN 5 more (@storybook/builder-vite, @storybook/react-vite, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer vite@"^3.0.0" from @joshwooding/vite-plugin-react-docgen-typescript@0.0.0-20221218231544
npm WARN node_modules/@joshwooding/vite-plugin-react-docgen-typescript
npm WARN @joshwooding/vite-plugin-react-docgen-typescript@"0.0.0-20221218231544" from @storybook/react-vite@7.0.0-beta.13
npm WARN node_modules/@storybook/react-vite
npm WARN
npm WARN Conflicting peer dependency: vite@3.2.5
npm WARN node_modules/vite
npm WARN peer vite@"^3.0.0" from @joshwooding/vite-plugin-react-docgen-typescript@0.0.0-20221218231544
npm WARN node_modules/@joshwooding/vite-plugin-react-docgen-typescript
npm WARN @joshwooding/vite-plugin-react-docgen-typescript@"0.0.0-20221218231544" from @storybook/react-vite@7.0.0-beta.13
npm WARN node_modules/@storybook/react-vite Didn't have this error in v7.0.0-beta.12 release |
@robin-thomas you're right, I'll open a PR today that should fix that. All that should be required is upgrade storybook to the latest release of |
@ndelangen Any idea when the fix will be released? |
@robin-thomas if this is causing you issues, you should be able to use an override to control the version of |
I didn't do a release yesterday due to a bad release of babel per #20382. hopefully we can get that resolved today |
Babel issue is resolved! Go go go @shilman |
ZOMG!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.14 containing PR #20359 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
@shilman while this and even this is hot — here's another concerning peer:
I might need Babel at some point (currently just using esbuild tsx loader, works great), but I definitely don't need fork because I am not typechecking in SB compiles. |
Looks like we need to add Do a similar change to make |
FWIW at the time of testing beta.14 I inherited Typescript from my monorepo root, but that's not a conventional behavior and isn't actually supported in PNPM yet. I am changing the actual project's I do still agree with optionality of |
I think the challenge is that storybook wants to support TypeScript "out of the box", without requiring users to install something else for it to work. This means that it has to include packages like this. |
Very valid points, I didn't think of that! Storybook is very keen on providing a guided startup experience, and that's where a user can specify whether or not they would like to use However I do understand if this is a subjective decision and these ideas do not fit within that. |
I think it would indeed be worth thinking through the overall installation process for storybook. For example, we could ask some questions about whether or not people want docs or tests or typescript, etc. And depending on the answers, we could potentially avoid installing a lot of dependencies. But that's something to think about after 7.0 is released. 😅 |
I'd be surprised if they're willing to make that kind of change, it's a much more established project, and it doesn't really make sense for it to make its dependency optional. Forking it just to make that change seems like the wrong approach too, from a maintenance burden perspective. I wonder if we just need to tell folks that this is a peer dep warning that they can safely ignore if they're not using typescript. |
I'm wondering if there's some thing we could set up maybe similar to |
I agree with @IanVS forking that package is a no-go. But that's a webpack-builder issue, so I'm guessing for vite, (what this specific issue is about) it's solved. |
Running
Yields
Originally posted by @shilman in #19821 (comment)
The text was updated successfully, but these errors were encountered: