Skip to content

Latest commit

 

History

History
43 lines (27 loc) · 1.03 KB

File metadata and controls

43 lines (27 loc) · 1.03 KB

Service Worker Example Project

This project showcases how to use the @dfinity/response-verification package to perform response verification within a service worker. Also see the Dfinity service worker for a full working example.

Gotchas

When bundling a service worker with Webpack, the target needs to be set to webworker. Otherwise Webpack will transform the import.meta.url line from wasm-bindgen into document.location.href, which will break in a service worker context.

Setup

From the root of this repository, install NPM dependencies:

pnpm i

Build the @dfinity/response-verification package:

pnpm run --filter @dfinity/response-verification build

Run with Webpack Dev Server

Run:

pnpm run --filter service-worker-example start

Run with HTTP Server

Bundle application:

pnpm run --filter service-worker-example build

Run:

pnpm run --filter service-worker-example start:http