Has anyone added Google Workbox to a sage 9 project?

Has anyone added Workbox service worker to a Sage9 project? If so is there anything I should be aware of?

I actually got this working in roots8.5.1. Install the cli globally https://www.npmjs.com/package/workbox-cli and and I added this to my project https://www.npmjs.com/package/workbox-sw

I added this task to my gulp file:

gulp.task('generate-service-worker', function() {
  return workbox.generateSW({
    globDirectory: 'dist',
    globPatterns: [
      '**/*.{js,jpg,gif,png,css,svg,json,svgz}'
    ],
    swDest: path.dist + '/sw.js',
    clientsClaim: true,
    skipWaiting: true
  }).then(({count, size, warnings}) => {
    // In case there are any warnings from workbox-build, log them.
    warnings.forEach(console.warn);
    console.log(`${count} files will be precached, totaling ${size} bytes.`);
    console.info('Service worker generation completed.');
  }).catch((error) => {
    console.warn('Service worker generation failed:', error);
  });
});

And changed the way the build task is completed because the clean function was deleting the dist directory at the same time the service worker was trying to see what files to cache which ended up being none. So here is my build function:

// ### Build
// `gulp build` - Run all the build tasks but don't clean up beforehand.
// Generally you should be running `gulp` instead of `gulp build`.
gulp.task('build', function(callback) {
  runSequence('styles',
              'scripts',
              'json',
              ['fonts', 'images'],
              'generate-service-worker',
              callback);
});

Has anyone tried implementing it with sage 9 ?

Google Workbox has a webpack plugin which i guess would just need a bit of neat configuration to work.