npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fis3-postpackager-sw-register

v1.0.6

Published

service worker register plugin for fis3

Readme

fis3-postpackager-sw-register

为 fis3 构建的项目解决 service worker 文件注册和更新的问题

功能同 Webpack 插件 sw-register-webpack-plugin 基本一致。

更多相关背景可参考 Lavas 官网文档:背景

Usage

安装

npm install fis3-postpackager-sw-register --save-dev

fis3 配置


fis.match('::package', {
    postpackager : fis.plugin('sw-register', {
        entry: '/src/common/index.html',
        // ...
    })
});

Options 参数

entry

{
    entry: '/src/common/index.html'
}

注入 sw-register 脚本的入口文件,通常为 html 形式,必填项

version

version 为 service-worker 注册提供的版本号,默认值: 当前时间的时间版本字符串

// 编译构建后的 sw-register.js 代码
navigator.serviceWorker && navigator.serviceWorker.register('/service-worker.js?v=20180130153156').then(() => {
    // ...
});

filePath

{
    filePath: '/src/sw-register.js'
}

插件默认使用内置的 service worker 注册文件 sw-register.js,可通过此配置项进行自定义

publicPath

配置 sw-register.js 的引用路径。插件默认将 sw-register.js 导出在 /src 目录,fis3 项目的配置可能将 /src 目录的 js 文件部署到特定路径,可通过此选项进行配置,默认值 '/'

swPrefix

// 产出的 sw-register 文件
navigator.serviceWorker && navigator.serviceWorker.register('${swPrefix}/service-worker.js').then(() => {
    // ...
});

fallbackFilePath

可选,降级标志文件路径。插件将在入口文件以 <script> 形式插入,默认标志名称为 window.SW_FALLBACK,若该值为 true,则 sw-register.js 不会引入执行,注册的 service worker 会被 unregister