Fetch .js.map Sourcemap files via ServiceWorker

39 Views Asked by At

I am using a ServiceWorker to intercept and serve .js files.

The Chrome Developer Tools -> Sources tab is reporting a 404 error attempting to load the .map files for the .js files.

The request for the .map files is sent directly from the DevTools as a normal fetch (HTTP) request, and the request does not go through the ServiceWorker nor appear in the Network tab of the debugged page.

I found More Tools -> Developer Resources -> "Load through website". The "Load through website" checkbox is checked and the .map file is listed in the list of requests. However, the request for the .map is not intercepted in the ServiceWorker:

  self.addEventListener('fetch', (ev: FetchEvent) => {
    ev.respondWith(swFetch(ev))
  })

How can I make the DevTools send the request for the Sourcemap through the ServiceWorker?

0

There are 0 best solutions below