New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

service-worker-register

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

service-worker-register

service worker register by webpack-manifest-resource-plugin manifest

latest
Source
npmnpm
Version
1.2.6
Version published
Maintainers
1
Created
Source

service-worker-register

NPM version build status Test coverage David deps npm download

service worker register by webpack service worker manifest service-worker-precache-webpack-plugin

Install

npm i service-worker-register --save

Usage

const serviceWorkerRegister = require('service-worker-register');
// The service-worker.js name will get really url address by sw-mapping.json file
serviceWorkerRegister.register('service-worker.js');

Configuration

serviceWorkerRegister.register(filename, options):

  • options.scope: {String} default: / - service worker scope
  • options.manifestUrl: {String} default: /public/sw-mapping.json - service worker filename mapping file
  • options.report: {Function} optional - service worker register error report interface

Function

The plugin depend on service-worker-precache-webpack-plugin

  • webpack-manifest-resource-plugin inject sw-mapping.json file content to global var SERVICE_WORKER_MANIFEST
// sw-manifest.js
{
  "config": {
    "localPublicPath": "/public/",
    "publicPath": "/public/"
  },
  "service-worker.js": "service-worker.4434ddf3js"
}
  • if SERVICE_WORKER_MANIFEST is be inject, use this configuration directly, otherwise launch the network based on options.manifestUrl URL

License

MIT

Keywords

service-worker

FAQs

Package last updated on 09 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts