mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
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:
parent
bbfd2b3cd3
commit
0ef202f2df
6 changed files with 78 additions and 13 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue