Use helpers to check environment in frontend (#27633)
This commit is contained in:
parent
7ef56d6e50
commit
277e6968f5
8 changed files with 28 additions and 9 deletions
|
@ -7,6 +7,8 @@ import * as perf from 'mastodon/performance';
|
|||
import ready from 'mastodon/ready';
|
||||
import { store } from 'mastodon/store';
|
||||
|
||||
import { isProduction } from './utils/environment';
|
||||
|
||||
/**
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
|
@ -21,7 +23,7 @@ function main() {
|
|||
root.render(<Mastodon {...props} />);
|
||||
store.dispatch(setupBrowserNotifications());
|
||||
|
||||
if (process.env.NODE_ENV === 'production' && me && 'serviceWorker' in navigator) {
|
||||
if (isProduction() && me && 'serviceWorker' in navigator) {
|
||||
const { Workbox } = await import('workbox-window');
|
||||
const wb = new Workbox('/sw.js');
|
||||
/** @type {ServiceWorkerRegistration} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue