Skip to content

Instantly share code, notes, and snippets.

@arackaf
Last active December 2, 2017 16:43
Show Gist options
  • Save arackaf/fe0368c3377373262819d33a215daafb to your computer and use it in GitHub Desktop.
Save arackaf/fe0368c3377373262819d33a215daafb to your computer and use it in GitHub Desktop.
new SWPrecacheWebpackPlugin({
mergeStaticsConfig: true,
filename: "service-worker.js",
importScripts: ["../sw-manual.js"], // <------------------- new
staticFileGlobs: [
"static/bootstrap/css/bootstrap-booklist-build.css",
"static/fontawesome/css/font-awesome-booklist-build.css",
"static/fontawesome/fonts/fontawesome-webfont.woff2",
"static/main-icon2.png",
"util/babelHelpers.min.js",
"offline.htm" // <------------------- new
],
ignoreUrlParametersMatching: /./,
stripPrefixMulti: {
"static/": "react-redux/static/",
"util/": "react-redux/util/",
"offline.htm": "react-redux/offline.htm"
},
runtimeCaching: [
getCache({ pattern: /^https:\/\/images-na.ssl-images-amazon.com/, name: "amazon-images1" }),
getCache({ pattern: /^https:\/\/ecx.images-amazon.com/, name: "amazon-images2" }),
getCache({ pattern: /^https:\/\/s3.amazonaws.com\/my-library-cover-uploads/, name: "local-images1" }),
getCache({ pattern: /book\/searchBooks/, name: "book-search", expires: 60 * 7 }), //7 minutes
getCache({ pattern: /book\/loadDetails/, name: "book-details" })
]
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment