简体   繁体   English

如何在Next.js中使用Google Workbox?

[英]How to use Google Workbox with Next.js?

I have an Next.js app that's currently using sw-precache and sw-precache-webpack-plugin to generate a service worker. 我有一个Next.js应用程序,当前正在使用sw-precache和sw-precache-webpack-plugin生成服务工作者。

I would like to migrate to use Google Workbox and workbox-webpack-plugin instead. 我想迁移使用Google Workbox和workbox-webpack-plugin。 Has anyone successfully done that in a Next.js context? 有没有人在Next.js上下文中成功完成此操作?

Someone creates this plugin, could be better(because I will need to fork it to include my css in the cache), but is fine for this. 有人创建了这个插件,可能会更好(因为我需要派生它以便将我的css包括在缓存中),但是这样做很好。 https://www.npmjs.com/package/next-workbox-webpack-plugin https://www.npmjs.com/package/next-workbox-webpack-plugin

next-offline seems to be the standard here. 下一个脱机似乎是这里的标准。 It "just works". 它“有效”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Workbox setDefaultHandler - How to use Workbox setDefaultHandler ServiceWorkers 和 Next.js:如何将生产环境中的 Service Worker 与 next.js 应用程序集成? - ServiceWorkers and Next.js: How would one integrate Service workers in production with a next.js app? 如何使用来自 workbox-recipes 的 Google 温暖策略缓存? - How do I use Google's Warm Strategy Cache from workbox-recipes? 如何在 cra-template-pwa 模板 create-react-app 应用程序中正确使用 Workbox 文件 service-worker.js? - How to use the Workbox file service-worker.js correctly in a cra-template-pwa template create-react-app app? Next.js PWA (Service Worker + Manifest.json) - Next.js PWA (Service Worker + Manifest.json) Next.js Service Worker 404 错误仅在生产构建中 - Next.js Service Worker 404 error in production build only 如何在 Web 应用程序中使用 Workbox Background Sync 进行离线发布请求 - How to use Workbox Background Sync in an Web App for offline post requests 如何导入工作箱 defaultRouter - how to import workbox defaultRouter workbox-google-analytics / service-worker 离线分析:“不能使用 'in' 运算符在 undefined 中搜索 'sync' - workbox-google-analytics / service-worker offline analytics: "Cannot use 'in' operator to search for 'sync' in undefined 我是否应该使用Workbox运行时缓存staleWhileRevalidate来缓存gtm.js? - Should i use workbox runtime caching staleWhileRevalidate to cache gtm.js?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM