Skip to content
This repository has been archived by the owner on Mar 1, 2020. It is now read-only.

Parcel plugin to generate a workbox service worker

License

Notifications You must be signed in to change notification settings

Cloud-CNC/parcel-plugin-workbox3

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parcel Plugin Workbox 3

issues last commit

THIS PACKAGE IS DEPRECATED AND WILL BE DELETED!

Fork of parcel-plugin-workbox by Anders Dahnielson.

Install

npm i parcel-plugin-workbox3 -D

Usage

When you build with Parcel, this plugin will automatically run generateSWString. You can customize the settings by adding a workbox section to your package.json. The full configuration options can be found here. Unfortunately, parcel will not resolve files when you use navigator.serviceWorker.register, so you must add your service worker to your parcel build target (In addition to your index file).

Example

package.json

{
  "workbox": {
    "importScripts": [
      "./worker.js"
    ],
  }
}

Note: you must include at least one script in the importScripts property.


index.js

const pkg = require('package.json');
navigator.serviceWorker.register(`./${pkg.workbox.swDest}`);

Note: importing package.json is generally considered insecure

FAQ

  • Whats different between this and the original?
    • Still maintained
    • Fixed uglify JS
    • Improved configuration support
      • Pass any configuration option you would normally pass to generateSWString
    • Local workbox copy
    • Reduced logging
  • Why not parcel-plugin-workbox2?
    • The name was already already taken on NPM
  • Why is this deprecated?
    • The main reason why this was created was for Cloud CNC which as of February, 2020 is no longer using Parcel. I don't use Parcel on any other projects as of now so I decided to deprecate this package as I don't have time to maintain it.

About

Parcel plugin to generate a workbox service worker

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%