true if running as a PWA, otherwise false.
// Development mode with NEXT_PUBLIC_IS_PWA=true
process.env.NODE_ENV = 'development';
process.env.NEXT_PUBLIC_IS_PWA = 'true';
console.log(isPWA()); // Output: true
// Production client-side on https://pwa.itoll.com
console.log(isPWA()); // Output: true
// Production client-side on https://itoll.com
console.log(isPWA()); // Output: false
Detects whether the current app is running as a Progressive Web App (PWA).
Behavior:
Development:
NEXT_PUBLIC_IS_PWAenvironment variable ('true'/'false').Production (client-side):
trueif the current hostname or pathname contains"pwa".pwa.localhost:3000,pwa.itoll.com, or/pwa/home.Production (server-side / SSR):
truesincewindowis not available.