diff --git a/src/serviceWorker.ts b/src/serviceWorker.ts index 14ef129c..366f4832 100644 --- a/src/serviceWorker.ts +++ b/src/serviceWorker.ts @@ -28,7 +28,7 @@ type Config = { export function register(config?: Config) { if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { // The URL constructor is available in all browsers that support SW. - const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); + const publicUrl = new URL(process.env.PUBLIC_URL as string, window.location.href); if (publicUrl.origin !== window.location.origin) { // Our service worker won't work if PUBLIC_URL is on a different origin // from what our page is served on. This might happen if a CDN is used to