feat: add option to disable service worker

This commit is contained in:
Ignacio Lizana 2025-10-07 15:57:14 +02:00
parent 1e241c7926
commit 670f119027
2 changed files with 2 additions and 1 deletions

View file

@ -36,7 +36,7 @@ i18n
const root = ReactDOM.createRoot(document.getElementById('app'));
root.render(<App />);
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator && process.env.SERVICE_WORKER_DISABLED !== 'true') {
window.addEventListener('load', () => {
navigator.serviceWorker.register('service-worker.js')
.catch((registrationError) => {

View file

@ -213,6 +213,7 @@ module.exports = (env, argv) => ({
new webpack.EnvironmentPlugin({
SENTRY_DSN: null,
...env,
SERVICE_WORKER_DISABLED: false,
DEBUG: argv.mode !== 'production',
VERSION: pachageJson.version,
COMMIT_HASH