question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] HMR doesn't work with Storybook 6.5.0

See original GitHub issue

What version of vite are you using?

2.9.9

System info and storybook versions

System: OS: macOS 12.3.1 CPU: Intel i7 Binaries: Node: 16.10.0 npm: 7.24.0 Browsers: Firefox Developer Edition 101.0b8 (64-bit) Chrome 101.0.4951.64

Describe the Bug

  1. To even be able to use @storybookjs/builder-vite i had to install @storybookjs/addon-svelte-csf. It didn’t want to work without it (and i didn’t have any .svelte stories yet.
  2. After installing @storybookjs/addon-svelte-csf (had to do it forcefully as there were some dependency conflicts @storybookjs/builder-vite stopped throwing errors.
  3. Running npm run storybook seems to just show the latest build ran with Webpack. When changing the stories’ contents, no there is no active HMR.
  4. Furthermore, if i remove .sveltekit and node_modules and then run
npm i
npm run storybook

i get this:

Zrzut ekranu 2022-05-19 o 10 58 41

Attatching repo with this issue in ZIP

sveltekit-storybook-vite-builder.zip

Link to Minimal Reproducible Example

No response

Participation

  • I am willing to submit a pull request for this issue.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
IanVScommented, May 19, 2022

That’s true, @smashercosmo, but the files should still update. They just flash instead of a smooth HMR. I think the issue that @allozaur was having originally was that there was a cached build in node_modules/.cache from webpack. And you hit the nail on the head for his other issue with global. Another possibility is to force jest-mock 28 to be used as described here: https://github.com/storybookjs/storybook/issues/15391#issuecomment-1129008376

0reactions
smashercosmocommented, May 19, 2022

@IanVS ok, yeah, I think you’re right @allozaur seems like not working HMR is a known issue. HMR only works when you change components, not stories. It’s mentioned in the docs https://github.com/storybookjs/builder-vite#known-issues

Read more comments on GitHub >

github_iconTop Results From Across the Web

@storybook/react | Yarn - Package Manager
▶️ Interactive stories to simulate user behavior and tools to debug it; ⚡️ On-demand architecture for smaller builds and faster load times; ⛸...
Read more >
Upgrading Storybook
Storybook is a frontend workshop for building UI components and pages in isolation. Thousands of teams use it for UI development, testing, and...
Read more >
storybookjs/storybook (Raised $170.00) - Issuehunt
[Bug]: Storybook v5.3 not working with "no such file or directory, stat . ... unknow description with storybook 6.5.0 and vitejs 3.0.
Read more >
MIGRATION.md - Storybook - Fossies
This is technically a breaking change, so if this affects you please file an issue in Github and we can consider reverting this...
Read more >
@storybook/core: Versions | Openbase
Bug Fixes. Angular: Fix "webpack_require.nmd is not a function issue" in Angular 15 #20043; CLI/React native: Fix addons template to import register instead ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found