Jump to main content

Nicolas Hoizey

  • articles
  • billets
  • links
  • notes
  • talks
  • archives
  • about

Note from 2 July 2020

  • Nicolas Hoizey
  • 2 July 2020
  • image, Service Worker, Workbox
  • 4 reactions

Wondering why my #Workbox based Service Workers breaks images on https://nicolas-hoizey-com.netlify.app/notes/ but not https://nicolas-hoizey.com/notes/

It's exactly the same code. 🤷‍♂️

https://github.com/nhoizey/nicolas-hoizey.com/blob/633f0f673c3d1c57cab22a3fa0eeb3a7fb230e05/assets/js/service-worker.js

4 reactions

4 replies

  1. Jeff Posnick avatar Jeff Posnick
    Different CSP?
    • 2 July 2020, 19:36
    • Source
  2. Nicolas Hoizey avatar Nicolas Hoizey
    They are the same:
    github.com/nhoizey/nicola…
    github.com/nhoizey/nicola…

    The strange thing is that there is no Cloudinary in there… 😅

    Anyway, it should behave the same, and with or without the SW.
    • 2 July 2020, 19:45
    • Source
  3. Nicolas Hoizey avatar Nicolas Hoizey
    Hum… maybe that's different after all, because we can't yet restrict headers to documents on @Netlify, so the CSP is also on the image.
    • 2 July 2020, 19:46
    • Source
  4. Nicolas Hoizey avatar Nicolas Hoizey
    Hum… maybe is it referring to `connect-src` instead of `img-src` because it comes from the Service Worker?
    • 2 July 2020, 19:59
    • Source
  • Older: Note from 2 July 2020
  • Newer: Note from 2 July 2020

Related contents with similar topics

  1. Note from 31 May 2023

    • Nicolas Hoizey
    • 31 May 2023
    • PWA, Service Worker, Workbox
    • 3 reactions

    Who still thinks writing a Service Worker for basic features (performance with cache, offline fallback) is cumbersome?

    Using #Workbox recipes make it so easy!

    Here's the Service Worker for https://pack11ty.dev 😍

    https://github.com/nhoizey/pack11ty/blob/main/src/assets/js/service-worker.js

  2. Note from 13 May 2023

    • Nicolas Hoizey
    • 13 May 2023
    • Eleventy, esbuild, Service Worker, Workbox

    If someone is creating service workers with #Workbox recipes and injectManifest, a build with #esbuild, and doesn't have any issues, I'm interested! 😅

    I have a very strange issue:

    https://github.com/GoogleChrome/workbox/issues/3207

    Bonus points if this is with #Eleventy

  3. Note from 6 May 2023

    • Nicolas Hoizey
    • 6 May 2023
    • Service Worker, Workbox
    • 1 reaction

    Is it ok to use Workbox's injectManifest with the recent recipes warmCache option?

    I tried this without success in the Service Worker in Pack11ty:

    staticResourceCache({
      warmCache: self.__WB_MANIFEST,
    });

    Other caches are warmed up, not this one.

  4. Note from 24 July 2020

    • Nicolas Hoizey
    • 24 July 2020
    • Service Worker, Workbox
    • 1 reaction

    Looks like #Workbox 6 will improve a few things I struggled with in the past, it became so easy to develop great Web Services! 👍

    https://github.com/GoogleChrome/workbox/releases/tag/v6.0.0-alpha.1

  5. Note from 2 March 2020

    • Nicolas Hoizey
    • 2 March 2020
    • PWA, Rollup, Service Worker, Workbox
    • 2 reactions

    Tried to write a fresh new Service Worker with #Workbox 5 and #Rollup (first time ever), almost copy/pasted from what @jeffposnick did in https://github.com/GoogleChromeLabs/so-pwa but I get a strange error reporting mixed content… 😥

If you want to share an error or suggest an enhancement of this content, please edit the source on GitHub.

© Nicolas Hoizey

Built with Eleventy