Storybook: HMR(Hot module replacement) not working when stories are not in src folder

Created on 18 Jul 2017  ·  4Comments  ·  Source: storybookjs/storybook

Hi

My project structure looks like the following. I am able to get storybook working however, Webpack dev server HMR only works when I make changes to the 'src' folder. When I make changes to the stories themselves, the changes are not picked up.

├── .storybook        # Storybook configuration files
├── src                     # Source files
├── test                    # Automated tests 
├── stories               # Storybook stories in this folder

My config.js looks like the following

import { configure } from '@storybook/react';

const req = require.context('../stories', true, /story\.js$/)

function loadStories() {
  req.keys().forEach(req)
}

configure(loadStories, module);

Thanks
-Rv

babel / webpack inactive question / support

Most helpful comment

I have the same issue. Hot reload is detected on index.js and other "root" components of the app but not on UI components nor their stories. UI components and stories are in the same folder, e.g. Button/index.js and Button/stories.js.

This makes storybook unusable for me currently.

All 4 comments

I have the same issue. Hot reload is detected on index.js and other "root" components of the app but not on UI components nor their stories. UI components and stories are in the same folder, e.g. Button/index.js and Button/stories.js.

This makes storybook unusable for me currently.

You guys are more than welcome to submit a PR to fix this.

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. We do try to do some housekeeping every once in a while so inactive issues will get closed after 90 days. Thanks!

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

Was this page helpful?
0 / 5 - 0 ratings