disable msw in production mode

This commit is contained in:
Jacob Overgaard
2022-08-08 11:53:59 +02:00
parent 54c4a7e467
commit 73bc7f6fdc
4 changed files with 11 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
# Copy this to .env.local and change what you want to test.
VITE_UMBRACO_USE_MSW=on # on = turns on MSW, off = disables all mock handlers
VITE_UMBRACO_INSTALL_STATUS=running # running or must-install or must-upgrade
VITE_UMBRACO_INSTALL_PRECONFIGURED=false

View File

@@ -0,0 +1,4 @@
# Copy this to .env.local and change what you want to test.
VITE_UMBRACO_INSTALL_STATUS=running # running or must-install or must-upgrade
VITE_UMBRACO_INSTALL_PRECONFIGURED=false
VITE_UMBRACO_USE_MSW=off

View File

@@ -1,5 +1,9 @@
import 'element-internals-polyfill';
import { startMockServiceWorker } from './mocks/browser';
startMockServiceWorker();
if (import.meta.env.VITE_UMBRACO_USE_MSW === 'on') {
startMockServiceWorker();
}
import('./app');

View File

@@ -2,4 +2,5 @@
interface ImportMetaEnv {
VITE_UMBRACO_INSTALL_STATUS: 'running' | 'must-upgrade' | 'must-install';
VITE_UMBRACO_INSTALL_PRECONFIGURED: string;
VITE_UMBRACO_USE_MSW: 'on' | 'off';
}