我有一个用create-react-app
创建的反应应用程序,我已添加了故事书。当我运行yarn run storybook
时,我在更改文件时不会重新加载。
我的申请表格如
src
->components
--->aComponent.js
->stories
--->index.js
->index.js
这是我的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"
}
}
我没有自定义网络包配置。我需要做些什么来使热模块重新加载工作?
答案 0 :(得分:2)
您必须增加手表数量
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
答案 1 :(得分:0)
遇到相同的问题,应将module
作为第二个参数传递storiesOf
// V Won't hot reload with `module`
storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />);
答案 2 :(得分:0)
我也有这个问题,
我的环境是:
ubuntu 18.04
"react": "^16.10.1",
"react-dom": "^16.10.1",
"react-scripts": "3.1.2",
"@storybook/react": "^5.2.1"
我通过以sudo用户身份运行来解决了这个问题:
sudo yarn run storybook