Skip to content

Commit

Permalink
FIX service worker location
Browse files Browse the repository at this point in the history
  • Loading branch information
shajz committed Dec 29, 2022
1 parent a452a46 commit 0b468d8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 306 deletions.
2 changes: 1 addition & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
stories: ['../stories/**/*.stories.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'],
staticDirs: ['./public'],
staticDirs: ['public'],
addons: ['@storybook/addon-essentials', '@storybook/addon-a11y'],
core: {
builder: 'webpack5',
Expand Down
303 changes: 0 additions & 303 deletions .storybook/msw/mockServiceWorker.js

This file was deleted.

9 changes: 8 additions & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,12 @@ if (typeof global.process === 'undefined') {
// Start the mocking when each story is loaded.
// Repetitive calls to the `.start()` method do not register a new worker,
// but check whether there's an existing once, reusing it, if so.
worker.start();
worker.start({
serviceWorker: {
// Points to the custom location of the Service Worker file.

url: 'mockServiceWorker.js',
scope: '/',
},
});
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,6 @@
"node": "18.12.1"
},
"msw": {
"workerDirectory": ".storybook/msw"
"workerDirectory": ".storybook/public"
}
}

0 comments on commit 0b468d8

Please sign in to comment.