mischnic/parcel-plugin-sw-cache

How to pre-process the service worker with Parcel?

jtojnar opened this issue · 1 comments

I have some imports, as well as some other modern JavaScript features in the ServiceWorker but they are not processed by Parcel/Babel – the generated file still contains:

import {skipWaiting} from 'workbox-core';
import {precacheAndRoute} from 'workbox-routing';

How to make Parcel to process the file?

I am using the following config:

  "cache": {
    "strategy": "inject",
    "swSrc": "./js/selfoss-sw-offline.js",
    "templatedURLs": {},
    "swDest": "service-worker.js"
  }

That is unfortunately not possible with this plugin (you need to do an extra buildstep beforehand)