1.2.1 • Published 6 years ago
parcel-plugin-workbox3 v1.2.1
Parcel Plugin Workbox 3
THIS PACKAGE IS DEPRECATED AND WILL BE DELETED!
Fork of parcel-plugin-workbox by Anders Dahnielson.
Install
npm i parcel-plugin-workbox3 -DUsage
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
- Pass any configuration option you would normally pass to
- 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.