support service worker / pwa's

Open
#46 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
32/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript
Domain
devops

Research direction

Start with the config/deploy.js example and trace how the ember-lightning server handles requests for sw.js versus index.html. The work is complete when service-worker content can be deployed and served alongside the application index, with the ref-based preview behavior explicitly resolved or documented.

Written by the indexing model from the issue text.

Description

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
// 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.

Dominant language
JavaScript
Stars
37
Forks
20
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.