Newer
Older
navi-1 / webclient / src / main.js
@Eugene Sukhodolskiy Eugene Sukhodolskiy 18 hours ago 612 bytes PWA: installable webclient, offline shell, web push
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import './styles/main.scss'
import { GnexusUiVue } from 'gnexus-ui-kit/vue'

const app = createApp(App)
app.use(createPinia())
app.use(GnexusUiVue)
app.mount('#app')

// PWA: register the service worker in production builds only — dev never
// registers, so HMR stays untouched. Failure is silently non-fatal: without
// the SW the app still works online, just without install/offline/push.
if (import.meta.env.PROD && 'serviceWorker' in navigator) {
  navigator.serviceWorker.register('/sw.js').catch(() => {})
}