就这么简单,热加载根本不起作用,我按照确切的步骤https://storybook.js.org/docs/guides/guide-react/
.storybook / config.js
import { configure } from '@storybook/react';
// automatically import all files ending in *.stories.js
const req = require.context('../stories', true, /\.stories\.js$/);
function loadStories() {
req.keys().forEach(filename => req(filename));
}
configure(loadStories, module);
stories / index.stories.js
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { linkTo } from '@storybook/addon-links';
import { Button, Welcome } from '@storybook/react/demo';
storiesOf('Welcome', module).add('to Storybasdook', () => <Welcome showApp={linkTo('Button')} />);
storiesOf('Buttasdawon', module)
.add('with text', () => <Button onClick={action('clicasdawked')}>Hello Button</Button>)
.add('with some emoji', () => (
<Button onClick={action('clicked')}>
<span role="img" aria-label="so cool">
? ? ? ?
</span>
</Button>
));
当我运行yarn storybook
时一切正常,但是可以说我想将.add('with some emoji'..
更改为.add('with some emojiiiiii..'
,但没有任何变化,我需要重新启动yarn storybook
来查看更改>