Created
August 28, 2019 06:06
-
-
Save tkssharma/d6bbcbc65bed527b7ab9f2d1dc8f292b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {rewireWorkboxInject, defaultInjectConfig} = require('react-app-rewire-workbox'); | |
const path = require('path'); | |
module.exports = function override(config, env) { | |
if (env === "production") { | |
console.log("Production build - Adding Workbox for PWAs"); | |
// Extend the default injection config with required swSrc | |
const workboxConfig = { | |
...defaultInjectConfig, | |
swSrc: path.join(__dirname, 'src', 'custom-sw.js') | |
}; | |
config = rewireWorkboxInject(workboxConfig)(config, env); | |
} | |
return config; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment