[PWA] Service worker app cache duration

Changing the service-worker.js file on each build as suggested by @Tommertom is also what I did.
I run this gulp task after each production build:

const gulp = require('gulp');
const footer = require('gulp-footer');

gulp.task('sw-build-date', () => {
  return gulp.src('www/service-worker.js')
    .pipe(footer("//" + (new Date()).toISOString()))
    .pipe(gulp.dest('www'))
});
1 Like