Skip to content

Commit 427e144

Browse files
fix: use self.__WB_MANIFEST literal in sw.js for workbox-build injectManifest
workbox-build does a text search for the exact string 'self.__WB_MANIFEST' in the service worker source. Using it via an alias (sw.__WB_MANIFEST where const sw = self) is not matched, causing the Docker build to fail with: 'Unable to find a place to inject the manifest.' Fixes the Docker Publish GitHub Actions workflow failure.
1 parent d707a1a commit 427e144

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

client/src/sw.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
const sw = /** @type {ServiceWorkerGlobalScope} */ (self);
66

7-
// vite-plugin-pwa injectManifest requires this reference.
8-
// We use it to pre-cache static assets on install.
9-
const precacheManifest = sw.__WB_MANIFEST;
7+
// workbox-build (injectManifest) searches for the LITERAL string self.__WB_MANIFEST.
8+
// Must reference self directly here — aliased access (sw.__WB_MANIFEST) is not detected.
9+
// eslint-disable-next-line no-undef
10+
const precacheManifest = self.__WB_MANIFEST;
1011

1112
const CACHE_NAME = 'openfamily-v1';
1213

0 commit comments

Comments
 (0)