DevTip: Two steps for using Workbox in a Chrome Extension

twitter logo github logo ・1 min read

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:

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 :)

twitter logo DISCUSS
Classic DEV Post from Jun 23

Being a Female Programmer: How is it For You?

This probably depends on where we live and work, but personally, I have not experienced anything negative for being a female programmer in my few years of career.

Ido Shamun profile image
Co-Founder The Elegant Monkeys, Co-Maker of Daily and a passionate software developer