ember-cli-deploy / ember-cli-deploy/ember-cli-deploy-lightning-pack

support service worker / pwa's

Offen
#46 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
37
Forks
20
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

follow up to conversation with @lukemelia on slack...

so to get the service worker working with the lightning approach here’s what we had to do:

* alias ember-cli-deploy-redis to upload both index and sw.js to parallel nodes: `app-name:{index|sw}:current-content`

```js
// config/deploy.js
var moduleName = require('../package.json').name;
var ENV = {
pipeline: {
alias: {
redis: { as: ['redis-index', 'redis-sw']}
}
},
"redis-index": {
allowOverwrite: true,
keyPrefix: `${moduleName}:index`,
filePattern: 'index.html'
},
"redis-sw": {
allowOverwrite: true,
keyPrefix: `${moduleName}:sw`,
filePattern: 'sw.js'
},
gzip: {
// not required but makes troubleshooting a lot easier
// be sure to add 'content-encoding: gzip' to response if gzip is enabled
ignorePattern: 'sw.js'
},
// …
};
```

* We then had to update our ember-lightning server to detect requests for sw.js and to respond with the appropriate content where it was always responding with the index.html content previously for any request of a given domain.

* One thing to note is that supporting the ref based preview url isn’t practical here for the service worker itself as we’d need to modify the path embedded in the index file to request this specific version of the service worker. This is certainly possible but isn’t anything that we tackled for now.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.