Pwa offline application cache use APP in many practical applications will be used
Important plugin: workbox-webpack-plugin
Download and install
Introduce and use in webpack.config.js file configuration
add in plugins
new WorkboxWebpackPlugin.GenrateSW({clientClaim: true, skipWaiting: true})
Use, import service-worker in the entry file
// 判断浏览器是否支持,需要添加对应的逻辑
if('serviceWorker' in navigator) {
window.addEventListener('load', fucntion() {
navigator.serviceWorker.register("/service-workre.js").
then(
()=>{},
()=>{}
)
})
}
service-worker needs to run on the server side
serve plugin
serve -s (directory) expose the directory files and create a service to access the project
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。