Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 29, 2020 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velotiotech/419da233a9a5962f9ab4440d258a299d to your computer and use it in GitHub Desktop.
Save velotiotech/419da233a9a5962f9ab4440d258a299d to your computer and use it in GitHub Desktop.
const WorkboxWebpackPlugin = require("workbox-webpack-plugin");
module.exports = function override(config, env) {
config.plugins = config.plugins.map((plugin) => {
if (plugin.constructor.name === "GenerateSW") {
return new WorkboxWebpackPlugin.InjectManifest({
swSrc: "./src/service-worker-custom.js",
swDest: "service-worker.js"
});
}
return plugin;
});
return config;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment