Skip to content

Commit

Permalink
Docs: Add troubleshooting section and update reference to statics (#109
Browse files Browse the repository at this point in the history
…) [skip-ci]
  • Loading branch information
yannbf committed Apr 21, 2023
1 parent a2de133 commit 45bbc65
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ export const decorators = [mswDecorator];

### Start Storybook

When running Storybook, you have to serve the `public` folder as an asset to Storybook. Refer to [the docs](https://storybook.js.org/docs/react/configure/images-and-assets) if needed.
When running Storybook, you have to serve the `public` folder as an asset to Storybook. This means you should set the `staticDirs` field in the Storybook main config file. Refer to [the docs](https://storybook.js.org/docs/react/configure/images-and-assets#serving-static-files-via-storybook-configuration) if needed.

```sh
npm run start-storybook -s public
npm run start-storybook
```

## Usage
Expand Down Expand Up @@ -216,3 +216,11 @@ initialize({
},
})
```

### Troubleshooting

#### MSW is interfering with HMR (Hot Module Replacement)

If you're experiencing issues like `[MSW] Failed to mock a "GET" request to "http://localhost:6006/4cb31fa2eee22cf5b32f.hot-update.json"` in the console, it's likely that MSW is interfering with HMR. This is not common and it seems to only happen in Webpack projects, but if it happens to you, you can follow the steps in this issue to fix it:

https://github.com/mswjs/msw-storybook-addon/issues/36#issuecomment-1496150729
12 changes: 10 additions & 2 deletions packages/docs/src/guides/GettingStarted.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ export const decorators = [mswDecorator];

### Start Storybook

When running Storybook, you have to serve the `public` folder as an asset to Storybook. Refer to [the docs](https://storybook.js.org/docs/react/configure/images-and-assets) if needed.
When running Storybook, you have to serve the `public` folder as an asset to Storybook. This means you should set the `staticDirs` field in the Storybook main config file. Refer to [the docs](https://storybook.js.org/docs/react/configure/images-and-assets#serving-static-files-via-storybook-configuration) if needed.

```sh
npm run start-storybook -s public
npm run start-storybook
```

## Usage
Expand Down Expand Up @@ -207,3 +207,11 @@ initialize({
},
})
```

### Troubleshooting

#### MSW is interfering with HMR (Hot Module Replacement)

If you're experiencing issues like `[MSW] Failed to mock a "GET" request to "http://localhost:6006/4cb31fa2eee22cf5b32f.hot-update.json"` in the console, it's likely that MSW is interfering with HMR. This is not common and it seems to only happen in Webpack projects, but if it happens to you, you can follow the steps in this issue to fix it:

https://github.com/mswjs/msw-storybook-addon/issues/36#issuecomment-1496150729

1 comment on commit 45bbc65

@vercel
Copy link

@vercel vercel bot commented on 45bbc65 Apr 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

msw-storybook-addon – ./

msw-storybook-addon-git-main-mswjs.vercel.app
msw-storybook-addon-mswjs.vercel.app
msw-sb.vercel.app

Please sign in to comment.