gpt4 book ai didi

create-react-app - 如何在 Create-React-App 2 中更改 PWA 工作箱缓存策略

转载 作者:行者123 更新时间:2023-12-03 17:31:31 25 4
gpt4 key购买 nike

Create-react-app v2 使用 workbox cacheFirst 策略。我想使用 staleWhileRevalidate。如何创建自定义 Service Worker 并将其添加为现有应用程序?

最佳答案

请更新至 create-react-app v4 如果你想更多地控制你的服务 worker 。
您可以启动一个将使用服务工作线程的新项目,您可以对其进行更改:

npx create-react-app my-app --template cra-template-pwa
详情在 current documentation .

关于create-react-app - 如何在 Create-React-App 2 中更改 PWA 工作箱缓存策略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53079734/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com