I am using Expo SDK Version: 36 to generate a PWA.
curl http://$LOCAL_IP:19006/expo-service-worker.js: OK 200
curl http://localhost:19006/expo-service-worker.js: FAIL => Instead of serving expo-service-worker.js
it serve the static assetindex.html`.
Failed to register service-worker DOMException: Failed to register a ServiceWorker for scope ('http://localhost:19006/') with script ('http://localhost:19006/expo-service-worker.js'): The script has an unsupported MIME type ('text/html').
expo-service-worker.js is not served and this is problematic when you must implement web push notification because only
localhost can work without it when site is not served with
- Failed to register service-worker DOMException: Failed to register a ServiceWorker for scope (‘http://localhost:19006/’) · Issue #2063 · expo/expo-cli · GitHub
- Expo: How to fix web push notification in development when accessing throw localhost (and how to fix the `localhost` service worker)? · Issue #2468 · expo/expo-cli · GitHub
How can I fix it?