Reputation: 10081
I have a react application I created with create-react-app
and I have added storybook to it. When I run yarn run storybook
it does not reload when I change files.
My application is laid out like
src
->components
--->aComponent.js
->stories
--->index.js
->index.js
Here is my package.json
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"immutable": "^3.8.2",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-scripts": "1.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"storybook": "start-storybook -p 9009 -s public",
"build-storybook": "build-storybook -s public"
},
"devDependencies": {
"@storybook/addon-actions": "^3.3.14",
"@storybook/addon-links": "^3.3.14",
"@storybook/addons": "^3.3.14",
"@storybook/react": "^3.3.14",
"babel-core": "^6.26.0",
"flow-bin": "^0.67.1"
}
}
I have no custom web pack config. What do I need to do to get hot module reloading working?
Upvotes: 9
Views: 12086
Reputation: 51
You must increase your watch count
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Upvotes: 5
Reputation: 324
I had this problem too,
my environment was:
ubuntu 18.04
"react": "^16.10.1",
"react-dom": "^16.10.1",
"react-scripts": "3.1.2",
"@storybook/react": "^5.2.1"
I solved this problem with running as the sudo user like this:
sudo yarn run storybook
Upvotes: 0
Reputation: 53994
Had the same issue, should pass module
as a 2nd argument for storiesOf
// V Won't hot reload with `module`
storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />);
Upvotes: 0