Skip to content

Commit d829f75

Browse files
authored
fix: import and start mock service worker in development environment only (#4642)
1 parent fd99da7 commit d829f75

File tree

1 file changed

+3
-5
lines changed
  • spring-boot-admin-server-ui/src/main/frontend

1 file changed

+3
-5
lines changed

spring-boot-admin-server-ui/src/main/frontend/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import {
3131
useApplicationStore,
3232
} from './composables/useApplicationStore.js';
3333
import i18n from './i18n';
34-
import { worker } from './mocks/browser';
3534
import Notifications from './notifications.js';
3635
import SbaModalPlugin from './plugins/modal';
3736
import sbaConfig from './sba-config';
@@ -44,6 +43,9 @@ const applicationStore = createApplicationStore();
4443
const viewRegistry = createViewRegistry();
4544

4645
if (process.env.NODE_ENV === 'development') {
46+
const { worker } = await import('./mocks/browser');
47+
await worker.start();
48+
4749
globalThis.__VUE_OPTIONS_API__ = true;
4850
globalThis.__VUE_PROD_DEVTOOLS__ = true;
4951
}
@@ -75,10 +77,6 @@ sbaConfig.extensions.css.forEach((extension) => {
7577

7678
moment.locale(navigator.language.split('-')[0]);
7779

78-
if (process.env.NODE_ENV === 'development') {
79-
await worker.start();
80-
}
81-
8280
const installables = [Notifications, ...views];
8381
installables.forEach((installable) => {
8482
installable.install({

0 commit comments

Comments
 (0)