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]: The @storybook/nextjs framework corrupts images #20611

Closed
bartlangelaan opened this issue Jan 13, 2023 · 2 comments
Closed

[Bug]: The @storybook/nextjs framework corrupts images #20611

bartlangelaan opened this issue Jan 13, 2023 · 2 comments

Comments

@bartlangelaan
Copy link
Contributor

bartlangelaan commented Jan 13, 2023

Describe the bug

The @storybook/nextjs framework plugin is very fast and easy to setup. However, images don't seem to be working. Not during development, and not in production mode.

If I look at the generated files in the production build, I can see that the image was built, but the end result is corrupted. I can't open the file.

I have reproduced this on two different computers (1 WSL and 1 Mac). The image is build correctly when I replace the nextjs framework plugin with the react-webpack5 framework plugin.

I have pushed a demo repo here: https://github.com/Popup-IO/test-next-sb

To Reproduce

  1. npx create-next-app@latest
  2. npx sb@next init
  3. Place an image in the stories folder, and import it within a story
  4. npm run build-storybook
  5. Open storybook-static/static/media/my-image.[hash].jpg

Or, use the demo repo and run step 4 & 5.

System

  System:
    OS: Linux 5.10 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 18.7.0 - /mnt/wslg/runtime-dir/fnm_multishells/4783_1673609505642/bin/node
    Yarn: 1.22.19 - /mnt/wslg/runtime-dir/fnm_multishells/4783_1673609505642/bin/yarn
    npm: 8.15.0 - /mnt/wslg/runtime-dir/fnm_multishells/4783_1673609505642/bin/npm
  npmPackages:
    @storybook/addon-essentials: ^7.0.0-beta.20 => 7.0.0-beta.20 
    @storybook/addon-interactions: ^7.0.0-beta.20 => 7.0.0-beta.20 
    @storybook/addon-links: ^7.0.0-beta.20 => 7.0.0-beta.20 
    @storybook/blocks: ^7.0.0-alpha.8 => 7.0.0-beta.20 
    @storybook/nextjs: ^7.0.0-alpha.41 => 7.0.0-beta.20 
    @storybook/react: ^7.0.0-beta.20 => 7.0.0-beta.20 
    @storybook/react-webpack5: ^7.0.0-alpha.0 => 7.0.0-beta.20 
    @storybook/testing-library: ^0.0.13 => 0.0.13

Additional context

I have also posted this on the Discord with no response.

@bartlangelaan bartlangelaan changed the title [Bug]: The @next/plugin-storybook [Bug]: The @storybook/nextjs framework corrupts images Jan 13, 2023
@shilman
Copy link
Member

shilman commented Jan 17, 2023

Hurrah!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.29 containing PR #20615 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb@next upgrade --prerelease

Closing this issue. Please re-open if you think there's still more to do.

@rkrishnasanka
Copy link

@shilman When I upgraded to the prerelease, it broke everything, it seems like a couple of dependencies didn't install :

  • css-loader
  • utils

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants