mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
fix: Handle boolean value for SERVICE_WORKER_DISABLED
The `webpack.EnvironmentPlugin` provides the default value for `SERVICE_WORKER_DISABLED` as a boolean (`false`). The previous implementation only checked for the string `'true'`, which would fail to correctly identify the boolean `true` case, causing the feature to not work as intended when the variable was set without being explicitly a string. This commit updates the conditional check to handle both the boolean `true` and the string `'true'` to ensure the service worker is reliably disabled. Co-authored-by: Tim <tymmesyde@gmail.com>
This commit is contained in:
parent
670f119027
commit
57571cf1fc
1 changed files with 1 additions and 1 deletions
|
|
@ -36,7 +36,7 @@ i18n
|
|||
const root = ReactDOM.createRoot(document.getElementById('app'));
|
||||
root.render(<App />);
|
||||
|
||||
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator && process.env.SERVICE_WORKER_DISABLED !== 'true') {
|
||||
if (process.env.NODE_ENV === 'production' && process.env.SERVICE_WORKER_DISABLED !== 'true' && process.env.SERVICE_WORKER_DISABLED !== true && 'serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('service-worker.js')
|
||||
.catch((registrationError) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue