diff --git a/packages/cra-template-typescript/template/src/serviceWorker.ts b/packages/cra-template-typescript/template/src/serviceWorker.ts index b09523f155e..4d12c1ad7a2 100644 --- a/packages/cra-template-typescript/template/src/serviceWorker.ts +++ b/packages/cra-template-typescript/template/src/serviceWorker.ts @@ -29,7 +29,7 @@ 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, + process.env.PUBLIC_URL as string, window.location.href ); if (publicUrl.origin !== window.location.origin) {