How do I fetch my config json file inside service worker

I have a firebase configuration file inside my tools/apache/htdocs/apps/config/firebase-config.json
I need this config file in my serviceworker tools/apache/htdocs/firebase-messaging-sw.js

Is there any way in es5?


fetch("./config/firebaseConf.json").then(function (res) {
  return res.json();
}).then(function (data) {
 var firebase =  data;

The above code worked for me.

Source: stackoverflow