【React】 create-react-app的registerServiceWorker是什么?
关于create-react-app的registerServiceWorker
无论我如何谷歌搜索,都找不到信息。就像在灯塔下仍然是黑暗一样,当我打开registerServiceWorker.js文件时,发现有一条评论。
// In production, we register a service worker to serve assets from local cache.
// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on the "N+1" visit to a page, since previously
// cached resources are updated in the background.
// To learn more about the benefits of this model, read https://goo.gl/KwvDNy.
// This link also includes instructions on opting out of this behavior.
所以,这意味着它正在缓存。详细信息请参阅https://goo.gl/KwvDNy,因为它说这里,请看一下…
在实际生产时似乎是必需的,但在开发时希望不要缓存,所以可以考虑将其注释掉。
import { unregister } from './registerServiceWorker';
因为我还在学习中,所以还不太理解,但是你是不是想说以这种方式写入会确保能够清空缓存?
因此,我进行了“registerServiceWorker”的搜索,但无法找到日文解释,因此我将其留在这里。