-
Notifications
You must be signed in to change notification settings - Fork 7
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: Upgrading to Storybook 8.3.0
prereleases causes "Can't resolve 'tty' in..." error when compiling the manager
#76
Comments
8.3.0
prereleases causes "Can't resolve 'tty' in..." error when compiling stories8.3.0
prereleases causes "Can't resolve 'tty' in..." error when compiling stories
8.3.0
prereleases causes "Can't resolve 'tty' in..." error when compiling stories8.3.0
prereleases causes "Can't resolve 'tty' in..." error when compiling the manager
Upgrading to Storybook
Not sure if I should open another issue since this is also related to the upgrade. On the latest version of |
I'm investing this issue, Rsbuild could handle |
npm-check didn’t notify me of an update to Rsbuild, I’ll try installing latest tomorrow |
@JReinhold, cc @shilman First, thank you for providing such detailed error logs, I have found the reason for the problem:
The final stack causing the problem was at https://github.com/storybookjs/storybook/blob/next/code/core/src/common/utils/safeResolve.ts/#L13. I created a stackblitz (https://stackblitz.com/edit/node-fg7rkr?file=index.js) for you to clearly understand the difference in interpretation of When I think |
Hmm that's interesting @fi3ework, I've seen something similar before. But just to be clear, are you saying you think this breaks for any Storybook users using I've just tested with a Vite-based project that also uses uses |
Comparing webpack builder, I found it will still go into the The reason we haven't aligned this behavior before is that Rsbuild's configuration is also highly optimized. @chenjiahan, do you think we can rearrange the |
It's ok, we can give const extensions = [
// most projects are using TypeScript, resolve .ts(x) files first to reduce resolve time.
'.ts',
'.tsx',
+ '.mjs',
'.js',
'.jsx',
- '.mjs',
'.json',
]; |
Thank you for Storybook team's reaching out! The fix will be released soon and be compatible with Storybook 8.3.0. |
Fantastic team work! |
Just confirming that with the latest beta of both Storybook and Rsbuild everything works! Great work everyone! 🙌 |
Steps to reproduce
workspace:*
dependency inpackage.json
with*
if you like me, just downloaded that specific directory.pnpm install
npx storybook@next upgrade
pnpm storybook
... And as a UI overlay in the browser :
Workaround
As the tip in the terminal output suggests, adding the Node polyfill plugin resolves the issue:
Additional info
Node polyfills shouldn't be required for this. It seems that both from the filename
File: .../node_modules/@storybook/instrumenter/dist/index.js:1:1
and from the file content, RSBuild is resolving CJS / Node exports instead of the ESM exports. I don't know enough about RSBuild to understand if this is on purpose or not, but given it's bundling for the browser, I'd expect it to use theimport
conditions of packages' export maps and notnode
orrequire
.The offending chain of dependencies is:
@storybook/instrumenter
importsprocessError
from@vitest/utils/error
https://github.com/storybookjs/storybook/blob/next/code/lib/instrumenter/src/instrumenter.ts/#L14-L15@vitest/utils/error
importsformat
from@vitest/pretty-format
https://github.com/vitest-dev/vitest/blob/122e4fe0a7d4f208205617069b3df6a0ffaf7467/packages/utils/src/diff/index.ts#L11-L14@vitest/pretty-format
imports default fromtinyrainbow
https://github.com/vitest-dev/vitest/blob/122e4fe0a7d4f208205617069b3df6a0ffaf7467/packages/pretty-format/src/index.ts#L8node
condition oftinyraindow
importsnode:tty
https://github.com/tinylibs/tinyrainbow/blob/master/src/node.ts#L1Ideally the
/browser.js
file oftinyraindbow
should be hit via theimport
condition instead of the/node.js
file.My guess is that this is caused by Storybook internally upgrading to Vitest v2.0 in storybookjs/storybook#28788, which introduced Vitest utils' change from
picocolor
totinyrainbow
in vitest-dev/vitest#6077The text was updated successfully, but these errors were encountered: