
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
offlinejs-generator
Advanced tools
A simple generator that crawls your build directory and creates a ServiceWorker and injects a loader script into the index.html
npm i -D offlinejs-generator
Can be configured by creating an offline.json in your project root and calling:
offlinejs
Use a different config with:
offlinejs other-config.json
| attribute | default | description |
|---|---|---|
| path | "dist" | directory where your project build is generated |
| injectInto | "dist/index.html" | if the script should inject a loader script, if yes set it to "index.html" or the wanted target |
| template | "offline.js" | your ServiceWorker template |
| version | Date.now() | your project build version (new version is required for a new release) |
| exclude | false | regex as string to exclude specific files ( use [\\\\/] for slashed to make it OS independent) |
| include | ".*" | control what is loaded (file paths have to pass the exclude and include test) |
| data | {} | a flat object containing any data you need in the template (injection marks in your template shall look like this: /*[data.apiPort]*/) |
example offline.json:
{
"path": "dist",
"injectInto": false,
"template": "offline.js",
"exclude": "(assets[\\\\/]fonts[\\\\/].*)",
"data": {
"api": ":8080",
"hostname": "localhost",
"pushBadge": "http://localhost:4200/assets/push-badge.png"
}
}
Don't forget you still need a manifest.json in your dist folder!
FAQs
Generator for ServiceWorker serving static files
We found that offlinejs-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.