feat: support debugging PWA in dev (#4853)
* feat: support enabling pwa in dev * enable workbox debug * add prebuild script * fix lint
This commit is contained in:
@@ -26,7 +26,11 @@ type Config = {
|
||||
};
|
||||
|
||||
export const register = (config?: Config) => {
|
||||
if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) {
|
||||
if (
|
||||
(process.env.NODE_ENV === "production" ||
|
||||
process.env.REACT_APP_DEV_ENABLE_SW?.toLowerCase() === "true") &&
|
||||
"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);
|
||||
if (publicUrl.origin !== window.location.origin) {
|
||||
|
||||
Reference in New Issue
Block a user