首页 > 解决方案 > Storybook|React 热重载不工作 v5.1.11

问题描述

就这么简单,热重载根本不起作用,我按照确切的步骤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);

故事/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以查看更改

标签: typescriptstorybook

解决方案


推荐阅读