The Evento Portal is installable and offers a simple offline page when no internet connection is available. We use the vite-plugin-pwa that builds on Workbox to achieve this. The configuration is in vite.config.ts:
- We define the Web Manifest with the appropriate colors and icons.
- The ServiceWorker should pre-cache all necessary assets of the Evento Portal to render the base layout or "shell" (
index.html
, logo, icons and JavaScript files) but not the apps' files inpublic/apps
. - When building the application with
npm run build
, the ServiceWorker is generated todist/sw.js
, containing the file paths to pre-cache.
To test the Evento Portal with the ServiceWorker locally, you have to serve the app with a valid SSL certificate using the following command (with browserstack
as oAuthClientId
in public/settings.js
):
npm run preview:ssl
The application is served under https://bs-local.com:3000.
When no Internet connection is available (!navigator.onLine
), the <bkd-content> component is rendering an offline message instead of the app's content.