File tree Expand file tree Collapse file tree 6 files changed +13
-8
lines changed
Expand file tree Collapse file tree 6 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 1818 " frontend/src/gql/**" ,
1919 " frontend/src/routeTree.gen.ts" ,
2020 " frontend/.storybook/locales.ts" ,
21+ " frontend/.storybook/mockServiceWorker.js" ,
2122 " frontend/locales/*.json" ,
22- " frontend/stories/static/**" ,
2323 " **/coverage/**" ,
2424 " **/dist/**"
2525 ]
Original file line number Diff line number Diff line change @@ -9,8 +9,6 @@ import type { StorybookConfig } from "@storybook/react-vite";
99const config : StorybookConfig = {
1010 stories : [ "../{src,stories}/**/*.stories.@(js|jsx|ts|tsx)" ] ,
1111
12- staticDirs : [ "../stories/static" ] ,
13-
1412 addons : [
1513 // Automatic docs pages
1614 "@storybook/addon-docs" ,
@@ -57,6 +55,13 @@ const config: StorybookConfig = {
5755 env : {
5856 STORYBOOK : "true" ,
5957 } ,
58+
59+ viteFinal : async ( config ) => {
60+ // Host all the assets in the root directory,
61+ // so that the service worker is correctly scoped to the root
62+ config . build . assetsDir = "" ;
63+ return config ;
64+ } ,
6065} ;
6166
6267export default config ;
File renamed without changes.
Original file line number Diff line number Diff line change @@ -13,17 +13,19 @@ import type {
1313import { TooltipProvider } from "@vector-im/compound-web" ;
1414import { initialize , mswLoader } from "msw-storybook-addon" ;
1515import { useLayoutEffect } from "react" ;
16-
1716import "../src/shared.css" ;
1817import i18n , { setupI18n } from "../src/i18n" ;
19-
2018import { DummyRouter } from "../src/test-utils/router" ;
2119import { handlers } from "../tests/mocks/handlers" ;
2220import localazyMetadata from "./locales" ;
21+ import swUrl from "./mockServiceWorker.js?url" ;
2322
2423initialize (
2524 {
2625 onUnhandledRequest : "bypass" ,
26+ serviceWorker : {
27+ url : swUrl ,
28+ } ,
2729 } ,
2830 handlers ,
2931) ;
Original file line number Diff line number Diff line change 9292 "vitest" : " ^2.1.2"
9393 },
9494 "msw" : {
95- "workerDirectory" : [" stories/static " ]
95+ "workerDirectory" : [" .storybook " ]
9696 }
9797}
Original file line number Diff line number Diff line change @@ -50,6 +50,4 @@ mv target/doc target/book/rustdoc
5050cd frontend
5151npm ci
5252npx storybook build -o ../target/book/storybook
53- # Copy the mock service worker to the root of the domain, else it won't load
54- cp ../target/book/storybook/mockServiceWorker.js ../target/book/mockServiceWorker.js
5553cd ..
You can’t perform that action at this time.
0 commit comments