DEV Community

Ido Shamun
Ido Shamun

Posted on

DevTip: Two steps for using Workbox in a Chrome Extension

Recently the Chrome team enabled using service worker in Chrome Extensions, which is great news! Now we can intercept the extension requests which is good especially for caching and performance.
One library that really shines in terms of service worker caching is Google's Workbox but using it in a Chrome Extension is not that obvious so here is my tip:

Liquid error: internal

If you are using the webpack plugin for workbox simply add:
exclude: [/.*/], as part of your configuration

In your extension manifest.json set the following:
"content_security_policy": "script-src 'self' https://storage.googleapis.com; object-src 'self'",

Let me know how it goes for you :)

Top comments (0)