goldhand / goldhand/sw-precache-webpack-plugin

Using SW registration scope for default asset URLs

Open
#154 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.4k
Forks
101
PR merge metrics
No merged PRs in 30d

Description

* [ ] **I'm submitting a bug report**
* [x] **I'm submitting a feature request**
* [ ] **I'm submitting a support request**

**webpack version:**
4.x

**sw-precache-webpack-plugin version**:
0.11.4

**Please tell us about your environment:**
OSX 10.13.4

**Browser:**
Chrome 66

**Current behavior:**

In webpack 4, I can use an external global var to set the path for my app js and chunks by setting `__webpack_public_path__`.

SW Precache doesn't or can't use this as far as I can tell.

So I have a question - given that by default the service worker will be in the shared output directory, why not use the service worker registration scope to set the cached URLs? For example:

```js
self.registration.scope + 'path/to/file.js'
```

* **Webpack configuration:**

CRA default.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.