Skip to content

Instantly share code, notes, and snippets.

@nirzaq
Created March 8, 2018 01:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nirzaq/3b420e4324ceda4e516016de6aba4ed9 to your computer and use it in GitHub Desktop.
Save nirzaq/3b420e4324ceda4e516016de6aba4ed9 to your computer and use it in GitHub Desktop.
Next JS SWPrecache Config
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin')
module.exports = {
webpack: (config) => {
config.plugins.push(
new SWPrecacheWebpackPlugin({
verbose: true,
staticFileGlobsIgnorePatterns: [/\.next\//],
runtimeCaching: [
{
handler: 'networkFirst',
urlPattern: /^https?.*/
}
]
})
)
return config
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment