Gathering detailed insights and metrics for rollup-plugin-workbox
Gathering detailed insights and metrics for rollup-plugin-workbox
Gathering detailed insights and metrics for rollup-plugin-workbox
Gathering detailed insights and metrics for rollup-plugin-workbox
Guides, tools and libraries for modern web development.
npm install rollup-plugin-workbox
Typescript
Module System
Node Version
NPM Version
@web/test-runner-playwright@0.11.1
Updated on Jun 11, 2025
@web/rollup-plugin-import-meta-assets@2.3.0
Updated on Jun 10, 2025
@web/test-runner@0.20.2
Updated on May 21, 2025
@web/storybook-utils@1.1.2
Updated on May 19, 2025
@web/mocks@1.3.2
Updated on May 14, 2025
@web/storybook-framework-web-components@0.2.1
Updated on May 13, 2025
TypeScript (56.55%)
JavaScript (41.08%)
HTML (2.32%)
MDX (0.04%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
2,322 Stars
3,124 Commits
309 Forks
23 Watchers
58 Branches
150 Contributors
Updated on Jul 11, 2025
Latest Version
8.1.2
Package Id
rollup-plugin-workbox@8.1.2
Unpacked Size
51.73 kB
Size
17.01 kB
File Count
17
NPM Version
10.8.2
Node Version
20.18.2
Published on
Feb 18, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
Rollup plugin that builds a service worker with workbox as part of your rollup build
This package provides two rollup plugins: one that generates a complete service worker for you and one that generates a list of assets to precache that is injected into a service worker file.
The plugins are implemented as two function in the rollup-plugin-workbox module, named generateSW
and injectManifest
.
generateSW
Import the generateSW
plugin from rollup-plugin-workbox
, and add it to your plugins
array in your rollup.config.js
. The plugin takes a workbox config object, and an optional render function as the second argument.
You can find a detailed list of supported properties for the workbox config object here.
1const { generateSW } = require('rollup-plugin-workbox'); 2 3module.exports = { 4 input: 'main.js', 5 output: { 6 file: 'dist/bundle.js', 7 format: 'esm', 8 }, 9 plugins: [ 10 generateSW({ 11 swDest: '/dist/sw.js', 12 globDirectory: 'demo/dist/', 13 }), 14 ], 15};
You can also require
your workbox-config.js
file and pass it to the plugin.
1const { generateSW } = require('rollup-plugin-workbox'); 2 3const workboxConfig = require('./workbox-config.js'); 4 5module.exports = { 6 // ... 7 plugins: [generateSW(workboxConfig)], 8};
You can also customize the console output after workbox has generated your service worker by passing an optional render function as the second argument to the plugin:
1const { generateSW } = require('rollup-plugin-workbox'); 2 3const workboxConfig = require('./workbox-config.js'); 4 5module.exports = { 6 // ... 7 plugins: [ 8 generateSW(workboxConfig, { 9 render: ({ swDest, count, size }) => { 10 console.log('📦', swDest, '#️⃣', count, '🐘', size); 11 }, 12 }), 13 ], 14};
injectManifest
Import the injectManifest
plugin from rollup-plugin-workbox
, and add it to your plugins
array in your rollup.config.js
. The plugin takes a workbox config object, and an optional render function as the second argument.
You can find a detailed list of supported properties for the workbox config object here.
1const { injectManifest } = require('rollup-plugin-workbox'); 2 3module.exports = { 4 input: 'main.js', 5 output: { 6 file: 'dist/bundle.js', 7 format: 'esm', 8 }, 9 plugins: [ 10 injectManifest({ 11 swSrc: 'sw.js', 12 swDest: '/dist/sw.js', 13 globDirectory: 'demo/dist/', 14 }), 15 ], 16};
You can also require
your workbox-config.js
file and pass it to the plugin.
1const { injectManifest } = require('rollup-plugin-workbox'); 2 3const workboxConfig = require('./workbox-config.js'); 4 5module.exports = { 6 // ... 7 plugins: [injectManifest(workboxConfig)], 8};
You can also customize the console output after workbox has created your service worker by passing an optional render function as the second argument to the plugin:
1const { injectManifest } = require('rollup-plugin-workbox'); 2 3const workboxConfig = require('./workbox-config.js'); 4 5module.exports = { 6 // ... 7 plugins: [ 8 injectManifest(workboxConfig, { 9 render: ({ swDest, count, size }) => { 10 console.log('📦', swDest, '#️⃣', count, '🐘', size); 11 }, 12 }), 13 ], 14};
When using injectManifest
, your service worker will also automatically get bundled via esbuild
. During bundling, any mentions of Workbox's internal usage of process.env
variables will also be replaced, so you'll end up with a service worker that will have browser-compatible syntax only.
You can override the esbuild
options used like so:
1const { injectManifest } = require('rollup-plugin-workbox'); 2 3const workboxConfig = require('./workbox-config.js'); 4 5module.exports = { 6 // ... 7 plugins: [ 8 injectManifest(workboxConfig, { 9 esbuild: { 10 minify: false, 11 }, 12 }), 13 ], 14};
No vulnerabilities found.
Reason
30 commit(s) and 8 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
Reason
Found 2/8 approved changesets -- score normalized to 2
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
25 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More