Skip to content

Commit 536fc61

Browse files
authored
Merge pull request #10897 from marmelab/fix-crm-demo-msw-url
[chore] Fix CRM demo cannot load MSW when deployed on a sub URL
2 parents a4e8bd6 + d21ba0b commit 536fc61

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

examples/crm/src/index.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@ import { worker } from './providers/fakerest/fakeServer';
77
const container = document.getElementById('root');
88
const root = createRoot(container!);
99

10-
worker.start({ onUnhandledRequest: 'bypass', quiet: true }).then(() => {
11-
root.render(
12-
<React.StrictMode>
13-
<App />
14-
</React.StrictMode>
15-
);
16-
});
10+
worker
11+
.start({
12+
onUnhandledRequest: 'bypass',
13+
quiet: true,
14+
serviceWorker: { url: './mockServiceWorker.js' },
15+
})
16+
.then(() => {
17+
root.render(
18+
<React.StrictMode>
19+
<App />
20+
</React.StrictMode>
21+
);
22+
});
1723

1824
// If you want to start measuring performance in your app, pass a function
1925
// to log results (for example: reportWebVitals(console.log))

0 commit comments

Comments
 (0)