Closed mazipan closed 6 years ago
I'm sorry, I dont understand your question or what you are trying to do.
sw-toolbox
is a library, with code that executes at runtime in the browser. You're not going to have access to your local package.json
file in that context.
If you need to version caches or resources based on the context of your package.json
, it sounds like you would be better served by using a library that integrates with your build process and generates an appropriate service worker file based on your local filesystem.
sw-precache
is one such library that works alongside sw-toolbox
, and a newer option is using Workbox (which would fully replace sw-toolbox
).
I add
var CACHE_VERSION = '-v1.0.0'
in my sw.js But may I read this version from package.json ?