- From: Jake Archibald <notifications@github.com>
- Date: Mon, 20 May 2019 06:35:01 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 20 May 2019 13:35:24 UTC
Dynamic module loading can be done with:
```js
const modulePromise = import(useFoo ? './foo' : './bar');
addEventListener('fetch', event => {
event.respondWith(async function() {
const { whatever } = await modulePromise;
// …
}());
});
```
This feels better all round, as you won't be blocked on the import if your code doesn't use it.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1407#issuecomment-493989834
Received on Monday, 20 May 2019 13:35:24 UTC