-
Notifications
You must be signed in to change notification settings - Fork 106
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
Not fully compatible with Yarn PnP #141
Comments
Was there an error in the console? |
No, just
The exact errors were,
and When I added all of that packages, finally got no error message, but got infinite loading. |
This might be solved by #160. Can you please try updating to v0.1.9 and trying again? Thanks! |
I'm on |
We needed to revert #160. If you have a minute, could you try using version 0.1.9 to see if it does solve this particular issue? |
Still same bug using 0.1.9,
|
Can Confirm the bug still exists, my packages are
Falling back to nodeLinker: node-modules works. |
It's actually already added by one of the latest MRs but not yet released to NPM. |
Any update on when it will be released? |
I'm not sure what PR @erykpiast is talking about, but I've just released 0.1.14 of this project. |
You fixed it here @IanVS https://github.com/eirslett/storybook-builder-vite/pull/195/files thanks for releasing it! :) |
Not fixed for me with Yarn 3, PNP and Zero Installs: |
It kind of works now when you add
Another issue I'd say. |
I actually got this working, although it does take some effort. Here's what I did: 1: Add this to your viteFinal function in main.js
Install the following libraries:
Install and unplug
Go to the unplugged object-import's index.js and remove Remove any existing node_modules directories and run After these steps the default stories showed up for me. |
@samydoesit thanks for the report, but this issue is about problems with yarn. Would you mind opening a new issue and including a link to a reproduction repo? That's the best way for us to help you out. |
Hi, is anyone still having this issue? If not, I'd like to close this issue. If so, can you please share what versions you are using? |
Going to close for now, speak up if you think this should be re-opened. |
Getting the same issue with 5:29:28 PM [vite] Internal server error: Failed to resolve import "@storybook/addon-docs/dist/esm/frameworks/common/config.js" from "../../../../../../../virtual:/@storybook/builder-vite/vite-app.js". Does the file exist?
Plugin: vite:import-analysis
File: /virtual:/@storybook/builder-vite/vite-app.js
12 | } from '@storybook/client-api';
13 | import { logger } from '@storybook/client-logger';
14 | import * as config_0 from '@storybook/addon-docs/dist/esm/frameworks/common/config.js'
| ^
15 | import * as config_1 from '@storybook/addon-docs/dist/esm/frameworks/react/config.js'
16 | import * as config_2 from '@storybook/react/dist/esm/client/preview/config'
at formatError (/Users/yonatanbd/Code/clients/openreel/balloon-web/app/node_modules/vite/dist/node/chunks/dep-59dc6e00.js:38663:46)
at TransformContext.error (/Users/yonatanbd/Code/clients/openreel/balloon-web/app/node_modules/vite/dist/node/chunks/dep-59dc6e00.js:38659:19)
at normalizeUrl (/Users/yonatanbd/Code/clients/openreel/balloon-web/app/node_modules/vite/dist/node/chunks/dep-59dc6e00.js:56830:26)
at async TransformContext.transform (/Users/yonatanbd/Code/clients/openreel/balloon-web/app/node_modules/vite/dist/node/chunks/dep-59dc6e00.js:56979:57)
at async Object.transform (/Users/yonatanbd/Code/clients/openreel/balloon-web/app/node_modules/vite/dist/node/chunks/dep-59dc6e00.js:38900:30)
at async doTransform (/Users/yonatanbd/Code/clients/openreel/balloon-web/app/node_modules/vite/dist/node/chunks/dep-59dc6e00.js:55857:29) Fixed it with installing @storybook/addon-docs manually |
@yonathan06 did you previously have |
yes, version |
Wild. Could you reproduce the problem and share the output of |
this is the storybook packages I have currently installed (after fixing the error):
Before that, everything was up to date and working, it started to have errors after deleting |
I still have the exact same problem using storybook 6.4.22 and yarn 3.2.1 |
@capozzid can you please share a reproduction so I can help troubleshoot what's happening? |
Env: Node 14.19.1yarn version: 3.2.1 .yarnrc.yml
Installation
When running yarn storybook right after I get:
|
I was able to get this working, but it's not pretty. First of all, it seems necessary to set Then, because yarn pnp prevents us from relying on the correct packages being installed in node_modules from other storybook packages, it's necessary to install many of the internal storybook packages into your project as well. This is what I ended up with after hitting a "not found" error, adding the package, running
When you do this, it might be best to remove the If anyone else here has a good understanding of yarn pnp and how to make things work more cleanly, I'd love to hear from you! |
Using your solution I still get errors. The first one is the [vite] Internal server error: Failed to resolve import "global" from "../../../../../virtual:/@storybook/builder-vite/setup-addons.js". Does the file exist? |
I tried for a few days now, the last try I installed the not found packages then I got can not read |
I see that same error, @zhenximi. It seems to be related to this problem in vite: vitejs/vite#1979 Honestly, it seems like vite support for yarn PNP is not terribly good. :( |
@capozzid oh right, I forgot about the global thing, I had to adjust that. You can try adding it to your |
Thanks for your help @IanVS unfortunately I still have " TypeError: require_util_inspect() is undefined" error where storybook builds but can't display my stories |
Yeah, there's an unfixed compatibility problem, that breaks optional node-only modules usage within dependency packages. I have a PR here vitejs/vite#6493 but it's kind of blocked by the need to change how Vite's replacement module with usage warnings is implemented. Meanwhile, I have a cleaned up fix here: swandir/vite@927f524 Which I periodically apply on top of Vite releases and publish as tags You can build and pack a tarball from a tag (or your own fork) and use it via Yarn's |
Having same issue. Using: Storybook + SvelteKit
Deps:
|
I have a PR open in the main storybook repo which will address this for storybook 7.0. For now the workaround is to add the missing packages to your package.json. |
Piling onto this, when using Vue and PnP, builder-vite errors out completely even if
afaik |
Opened a PR to add the missing peer deps into this repo: #500 |
required adding a crazy litany of dev dependencies due to poor compatibility with yarn PNP: storybookjs/builder-vite#141 (comment)
required adding a crazy litany of dev dependencies due to poor compatibility with yarn PNP: storybookjs/builder-vite#141 (comment)
As a TLDR for anyone visiting this thread: I can confirm that adding a ton of storybook packages with
|
I was having trouble after upgrading a project to use Yarn PnP, I was getting similar errors to others who've had problems with Yarn PnP + Storybook, so I just spun up a fresh React + TypeScript + Tailwind project on Yarn 3.3.0 with PnP and then ran It seems like everything works fine as far as building storybook goes, then I get an error in the viewport:
This is the same error I was getting on my previous build, and if I fix this missing module by installing it, I get another, and another until all of these modules are added, then I end up with another error in the viewport:
Similar to this issue (#398) which seems to be closed with no real fix and I can't seem to resolve this last one. I've tried some of the workarounds such as seting packageExtension resolutions in |
@nedkelly many of these issues have been fixed in storybook 7.0, if you're willing to give that a shot you'll have much better luck when using pnp or pnpm. I think you still have to instll one extra MDX dependency, but we're trying to find a way to avoid that. |
Thanks @IanVS, I'll give it a go! |
@IanVS Unfortunately with a clean build starting with Storybook v7.0.0-alpha.53 I get the same error |
That might be a regression, we'll take a look, thanks! |
@IanVS I might have jumped the gun on that comment, it's not the same error, it's related to the other MDX issue you mentioned:
It looks like all of the other resolution issues are not present with webpack. Hope this helps. |
Ok, that's the last mdx dep that I mentioned were still finding a way to deal with. For now you can just install it manually in your project. |
https://github.com/remigailard80/Storybook-Vite
Env : Node 14.17
MacBook Air (M1, 2020) Big Sur 11.3.1
I tried to start storybook project with vite with this flow.
and saw this error.
After saw this error, I tried install @storybook/core-common, @storybook/client-api, @storybook/client-logger(?).
Eventually, it succeeded in running the development server, but it was caught in infinite loading.
But when i use
nodeLinker: node-modules,
It works fine.The text was updated successfully, but these errors were encountered: