Skip to content

Commit

Permalink
fix type for process.env.PUBLIC_URL.
Browse files Browse the repository at this point in the history
I followed this PR that's [Fix type for PUBLIC_URL in cra-template-typescript by JeromeDeLeon · Pull Request #8852 · facebook/create-react-app](facebook/create-react-app#8852)
  • Loading branch information
casaub0n committed Apr 18, 2020
1 parent 92bc88b commit 895869f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/serviceWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 895869f

Please sign in to comment.