Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude external media from service worker #224

Open
bravokiloecho opened this issue Feb 26, 2020 · 0 comments
Open

Exclude external media from service worker #224

bravokiloecho opened this issue Feb 26, 2020 · 0 comments

Comments

@bravokiloecho
Copy link

When I visit a page on my app that displays images from Instagram, it looks like the service worker is trying to cache these (see image at bottom).

I've tried to exlude these files by adding a workbox config to my next.config.js like this:

const withPlugins = require('next-compose-plugins')
const withOffline = require('next-offline')

// Next phase vars
const {
  PHASE_DEVELOPMENT_SERVER,
} = require('next/constants')

const nextConfig = {
  // Customise service worker
  workboxOpts: {
    exclude: [/^https:\/\/scontent\.xx\.fbcdn\.net.+/],
  },
}

module.exports = withPlugins([
  // load and apply a plugin only during development server phase
  [withOffline, ['!', PHASE_DEVELOPMENT_SERVER]],
], nextConfig)

But this doesn't seem to have any effect.

Is there a better way of doing this? I'm aware that I'm not totally familiar with all these things.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant