更改位置firebase-messaging-sw.js

I am trying to use Web Push Notification Using Firebase Cloud Messaging.

The service worker script is expected to be on the absolute path of the application! For example : http://127.0.0.1/firebase-messaging-sw.js

How to change this default location?! Searching the official docs I found this method: useServiceWorker which accepts a service worker registration, but trying to use it I get an error that the method doesn't even exist!

So, How to change the location of the service worker for firebase messaging?