mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-17 13:03:50 +00:00
Fixed preview generation, including service worker
This commit is contained in:
1
.github/workflows/deploy-preview.yml
vendored
1
.github/workflows/deploy-preview.yml
vendored
@@ -21,7 +21,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
npm ci --force && \
|
npm ci --force && \
|
||||||
node ./scripts/set-homepage.js /shlink-web-client/${GITHUB_HEAD_REF#refs/heads/} && \
|
node ./scripts/set-homepage.js /shlink-web-client/${GITHUB_HEAD_REF#refs/heads/} && \
|
||||||
rm src/service-worker.ts && \
|
|
||||||
npm run build
|
npm run build
|
||||||
- name: Deploy preview
|
- name: Deploy preview
|
||||||
uses: shlinkio/deploy-preview-action@v1.0.1
|
uses: shlinkio/deploy-preview-action@v1.0.1
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { ExpirationPlugin } from 'workbox-expiration';
|
|||||||
import { precacheAndRoute, createHandlerBoundToURL } from 'workbox-precaching';
|
import { precacheAndRoute, createHandlerBoundToURL } from 'workbox-precaching';
|
||||||
import { registerRoute } from 'workbox-routing';
|
import { registerRoute } from 'workbox-routing';
|
||||||
import { StaleWhileRevalidate } from 'workbox-strategies';
|
import { StaleWhileRevalidate } from 'workbox-strategies';
|
||||||
|
import pack from '../package.json';
|
||||||
|
|
||||||
declare const self: ServiceWorkerGlobalScope;
|
declare const self: ServiceWorkerGlobalScope;
|
||||||
|
|
||||||
@@ -49,7 +50,7 @@ registerRoute(
|
|||||||
// Return true to signal that we want to use the handler.
|
// Return true to signal that we want to use the handler.
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
createHandlerBoundToURL('/index.html') // TODO Add prefix
|
createHandlerBoundToURL(`${pack.homepage}/index.html`)
|
||||||
);
|
);
|
||||||
|
|
||||||
// An example runtime caching route for requests that aren't handled by the
|
// An example runtime caching route for requests that aren't handled by the
|
||||||
|
|||||||
Reference in New Issue
Block a user