From 895869f3fb980aeac9182d419e9b9dfbb17641e1 Mon Sep 17 00:00:00 2001 From: Casaubon Date: Sat, 18 Apr 2020 22:58:42 +1200 Subject: [PATCH] =?UTF-8?q?fix=20type=20for=20process.env.PUBLIC=5FURL.=20?= =?UTF-8?q?I=20followed=20this=20PR=20that's=20[Fix=20type=20for=20PUBLIC?= =?UTF-8?q?=5FURL=20in=20cra-template-typescript=20by=20JeromeDeLeon=20?= =?UTF-8?q?=C2=B7=20Pull=20Request=20#8852=20=C2=B7=20facebook/create-reac?= =?UTF-8?q?t-app](https://github.com/facebook/create-react-app/pull/8852)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/serviceWorker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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