How do I change the swpath value?

102 Views Asked by At
<!DOCTYPE html>
...
<head>
<script type="module">
   import 'https://cdn.jsdelivr.net/npm/@pwabuilder/pwaupdate';
   const el = document.createElement('pwa-update');
   document.body.appendChild(el);
</script>
...
</head>

I tried to apply a PWA to my site according to this document (https://github.com/pwa-builder/pwabuilder-web/blob/V2/src/assets/next-steps.md). However, that didn't work as intended, and looking at my browser's debug tools I found that I needed to change the value of swpath.

I tried various methods to change the value of swpath, but failed, and the repository only states that the value of swpath exists, but does not tell me how to change it. I was wondering how to change the value of swpath.

1

There are 1 best solutions below

2
On BEST ANSWER
<!DOCTYPE html>
<head>
...
<script type="module">
   import 'https://cdn.jsdelivr.net/npm/@pwabuilder/pwaupdate';
   const el = document.createElement('pwa-update');
   el.swpath = "/pwabuilder-sw.js";
   document.body.appendChild(el);
</script>
...
</head>

I solved the problem with the above code.