在你的Next.js项目中,使用上next-pwa插件,我们只修要将下面的代码贴入到里面即可。 代码语言:javascript 代码运行次数:0 运行 AI代码解释 /** @type {import('next').NextConfig} */constwithPWA=require('next-pwa')({dest:'public'})constnextConfig={}module.exports=withPWA(nextConfig); 如下图所示,...
1yarn add next-offline COPY 接着在next.config.js中配置如下 js 代码语言:javascript 代码运行次数:0 运行 AI代码解释 1const withOffline=require('next-offline')2module.exports=withOffline({3workboxOpts:{4swDest:process.env.NEXT_EXPORT5?'service-worker.js'6:'static/service-worker.js',7runtimeCac...
要将一个 PWA 部署为多个子应用,思路很简单,只需配置多个 web manifest 文件,每个子应用以 scope 属性区分便可。 而在Next.js 中,已经在app/路径下编写了 manifest.ts,这是 Next.js 提供的一个 API,用来生成 manifest.webmanifest 文件,但要注意它只在根目录生效,如果在子路由目录下编写这样的一个文件,并不...
Zero ConfigPWAPlugin forNext.jswith appDir support Archived, please usehttps://github.com/ducanhgh/next-pwa/, there are already active fork of next-pwa out there This plugin is powered byworkboxand other good stuff. Please ⭐️ star this repo if you find it useful 👆 ...
animereactjsanilistad-freeanime-websiteanime-streamingpwa-apptrack-animefree-animeconsumetanime-onlineanilist-trackernextjs14anify-apianiplay UpdatedJan 4, 2025 JavaScript ⚛️ Web Developers portfolio build with Gatsby.js & React.js reactnodejsportfolioexpresspwareactjssocket-iorealtimecvportfolio-web...
然后去 nextjs 官方仓库搜索,发现了这个东东https://github.com/vercel/next.js/tree/canary/examples/with-next-offline,瞄了一眼 package.json 发现了这个插件next-offline,瞅了一眼自述文件,貌似就是本文需要的插件,折腾一把,最终给https://www.jijian.link/添加了 PWA 功能。
log('Async writeText failed with error:"' + err + '"')); } else { var hasSelectio...
Quickly create a PWA on top of Next.js with zero config needed. Latest version: 1.1.1, last published: 9 months ago. Start using create-nextjs-pwa in your project by running `npm i create-nextjs-pwa`. There are no other projects in the npm registry using
CLI tool to set up PWA in Next.js projects. Latest version: 1.1.0, last published: a month ago. Start using nextjs-pwa-setup in your project by running `npm i nextjs-pwa-setup`. There are no other projects in the npm registry using nextjs-pwa-setup.
navigator.serviceWorker.register('/jslearning/sw.js') // 默认作用域为jslearning下,也可以通过设置scope参数进行设置 .then(function (registration) { // 注册成功 console.log('ServiceWorker registration successful with scope: ', registration.scope); ...