
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@ente-io/next-with-workbox
Advanced tools
Higher order Next.js configuration for generating a service worker
Higher order Next.js config to generate a Workbox service worker.
It auto-magically sets up certain aspects like pre-caching public
folder and cache busting exclusions in order
to get the most out of Workbox with Next.js.
Heavily inspired from shadowwalker/next-pwa.
yarn add next-with-workbox
Update or create next.config.js
with
const withWorkbox = require("next-with-workbox");
module.exports = withWorkbox({
workbox: {
swSrc: "worker.js",
},
// .
// ..
// ... other Next.js config
});
Add public/sw.js
and public/sw.js.map
to your .gitignore
public/sw.js
public/sw.js.map
Create your service worker at /path/to/your-next-app/worker.js
import { precacheAndRoute } from "workbox-precaching";
precacheAndRoute(self.__WB_MANIFEST);
Register your service worker at /path/to/your-next-app/pages/_app.js
:
import React, { useEffect } from "react";
import { Workbox } from "workbox-window";
function App({ Component, pageProps }) {
useEffect(() => {
if (
!("serviceWorker" in navigator) ||
process.env.NODE_ENV !== "production"
) {
console.warn("Pwa support is disabled");
return;
}
const wb = new Workbox("sw.js", { scope: "/" });
wb.register();
}, []);
return <Component {...pageProps} />;
}
export default App;
There are options you can use to customize the behavior of this plugin
by adding workbox
object in the Next.js config in next.config.js
.
Alongside those documented workbox
options below, this library would
also pass through any Workbox plugin options
to the appropriate plugin
const withWorkbox = require("next-with-workbox");
module.exports = withWorkbox({
workbox: {
dest: "public",
swDest: "sw.js",
swSrc: "worker.js",
force: true,
},
});
public
.sw.js
.false
.false
.FAQs
Higher order Next.js configuration for generating a service worker
The npm package @ente-io/next-with-workbox receives a total of 3 weekly downloads. As such, @ente-io/next-with-workbox popularity was classified as not popular.
We found that @ente-io/next-with-workbox 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.