title: How to use injectManifest in Workbox with Parcel-bundler?
body: <p>I am building a service worker for my PWA with Workbox.</p>
  <p>service-worker.js</p>
  <pre><code>import { registerRoute } from 'workbox-routing';
  import { NetworkFirst } from 'workbox-strategies';
  import { CacheFirst, StaleWhileRevalidate } from 'workbox-strategies';
  import { ExpirationPlugin } from 'workbox-expiration';
  import * as googleAnalytics from 'workbox-google-analytics';
  import { precacheAndRoute } from 'workbox-precaching';
  
  googleAnalytics.initialize();
  
  registerRoute(
      ({ request }) =&gt; request.destination === 'script',
      new NetworkFirst()
  );
  
  registerRoute(
      // Cache style resources, i.e. CSS files.
      ({ request }) =&gt; request.destination === 'style',
      // Use cache but update in the background.
      new StaleWhileRevalidate({
          // Use a custom cache name.
          cacheName: 'css-cache',
      })
  );
  
  registerRoute(
      // Cache image files.
      ({ request }) =&gt; request.destination === 'image',
      // Use the cache if it's available.
      new CacheFirst({
          // Use a custom cache name.
          cacheName: 'image-cache',
          plugins: [
              new ExpirationPlugin({
                  // Cache for a maximum of a week.
                  maxAgeSeconds: 7 * 24 * 60 * 60,
              }),
          ],
      })
  );
  
  precacheAndRoute(self.__WB_MANIFEST);
  
  if (process.env.NODE_ENV !== 'production') {
      console.log('This is a dev-only log message!');
  }
  
  </code></pre>
  <p>Is there a way that Parcel injects only the latest version of files in the service worker after each build?</p>
  <h2>My Attempts</h2>
  <ol>
  <li>I tried using workbox-build in a node script but each time I ran <code>npm run build</code>, it added all the versions of the file present in the <code>dist/</code> folder.</li>
  </ol>
  <p>service-worker.js (when I used a Node script)</p>
  <pre><code>// code skipped for brevity
  precacheAndRoute([
  {&quot;revision&quot;:&quot;78416d1f083fa1a898d17e20d741a462&quot;,&quot;url&quot;:&quot;Share.332aebe4.js&quot;},{&quot;revision&quot;:&quot;413f2ed8c0dcd51e3c01855ac307f6d2&quot;,&quot;url&quot;:&quot;Share.77f580e5.js&quot;},{&quot;revision&quot;:&quot;c95daa634502ca4a38e1822e7460688e&quot;,&quot;url&quot;:&quot;style.0f60499b.css&quot;},{&quot;revision&quot;:&quot;7f4b6e94999540101a2a7e5b4226080e&quot;,&quot;url&quot;:&quot;style.78032849.css&quot;}])
  </code></pre>
  <p>They were different versions of the same file but I want only the latest version</p>
  <ol start="2">
  <li>I tried using <code>parcel-plugin-sw-cache</code> but couldn't figure out how to use it due to insufficient documentation.</li>
  </ol>