Simple post-processing Service Worker.
npm install -g postsw
Add the following code to your project.
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js');
});
}
Or use with register-service-worker
postsw ./your_project_dist_dir
# postsw --help
location / {
index /index.html
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
expires off;
}
location ~ (sw.js)$ {
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
expires off;
}