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]: use of isomorphic-unfetch breaks storybook-next build #23700

Open
martaver opened this issue Aug 3, 2023 · 0 comments
Open

[Bug]: use of isomorphic-unfetch breaks storybook-next build #23700

martaver opened this issue Aug 3, 2023 · 0 comments

Comments

@martaver
Copy link

martaver commented Aug 3, 2023

Describe the bug

When importing [email protected] (latest) into a Component that is to be displayed in a Story in storybook, the storybook build breaks with:

Module not found: Error: Can't resolve 'unfetch' in '/Users/martaver/Projects/repro/node_modules/isomorphic-unfetch'

and several:

odule build failed: UnhandledSchemeError: Reading from "node:buffer" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.

of varying imports.

This might be simply a problem with isomorphic-unfetch, e.g. I know there is a problem with exports in unfetch:
developit/unfetch#162
developit/unfetch#164

However, since the same build error does NOT occur in next's build, I thought I'd flag this for the storybook team, since this suggests that storybook is doing something different in its build to next and I was under the impression that storybook should be utilising the same build configuration as next.

To Reproduce

https://github.com/cleric-sh/repro/tree/next-storybook-isomorphic-unfetch

Note the repro is in branch next-storybook-isomorphic-unfetch!

Run npm run storybook and check out the Button component. It imports isomorphic-unfetch without using it, which causes the aforementioned build errors.

System

Environment Info:

  System:
    OS: macOS 12.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 16.20.1 - ~/.config/nvm/versions/node/v16.20.1/bin/node
    Yarn: 1.22.19 - ~/.yarn/bin/yarn
    npm: 8.19.4 - ~/.config/nvm/versions/node/v16.20.1/bin/npm
  Browsers:
    Chrome: 115.0.5790.114
    Safari: 15.5
  npmPackages:
    @storybook/addon-essentials: 7.1.1 => 7.1.1 
    @storybook/addon-interactions: 7.1.1 => 7.1.1 
    @storybook/addon-links: 7.1.1 => 7.1.1 
    @storybook/addon-onboarding: ^1.0.8 => 1.0.8 
    @storybook/blocks: 7.1.1 => 7.1.1 
    @storybook/nextjs: 7.1.1 => 7.1.1 
    @storybook/react: 7.1.1 => 7.1.1 
    @storybook/testing-library: ^0.2.0 => 0.2.0

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant