forked from trent_larson/crowd-funder-for-time-pwa
docs: move build instructions from README to BUILDING.md
- Move detailed setup and build instructions from README.md to BUILDING.md - Add concise reference to BUILDING.md in README.md - Keep testing and other documentation in README.md - Improve organization of documentation by separating build-specific content
This commit is contained in:
@@ -3,7 +3,10 @@
|
||||
import { register } from "register-service-worker";
|
||||
|
||||
// Only register service worker if explicitly enabled and in production
|
||||
if (process.env.VITE_PWA_ENABLED === 'true' && process.env.NODE_ENV === "production") {
|
||||
if (
|
||||
process.env.VITE_PWA_ENABLED === "true" &&
|
||||
process.env.NODE_ENV === "production"
|
||||
) {
|
||||
register(`${process.env.BASE_URL}sw.js`, {
|
||||
ready() {
|
||||
console.log("Service worker is active.");
|
||||
@@ -21,12 +24,16 @@ if (process.env.VITE_PWA_ENABLED === 'true' && process.env.NODE_ENV === "product
|
||||
console.log("New content is available; please refresh.");
|
||||
},
|
||||
offline() {
|
||||
console.log("No internet connection found. App is running in offline mode.");
|
||||
console.log(
|
||||
"No internet connection found. App is running in offline mode.",
|
||||
);
|
||||
},
|
||||
error(error) {
|
||||
console.error("Error during service worker registration:", error);
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
console.log("Service worker registration skipped - not enabled or not in production");
|
||||
console.log(
|
||||
"Service worker registration skipped - not enabled or not in production",
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user