網站搜尋

typescript - Storybook|React 熱重載在 v5.1.11 無法運作


就是這麼簡單,Hot Reload 根本無法運作,我完全按照 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 才能看到變更