0

I recently updated these packages from version 5 to 7 :

  • workbox-core
  • workbox-precaching
  • workbox-webpack-plugin

My app uses react-app-rewired to override the config, here's what my config-overrides.js looks like :

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/custom-service-worker.js',
                swDest: 'service-worker.js',
                maximumFileSizeToCacheInBytes: 50000000
            });
        }
        return plugin;
    })
    return config;
}

It used to work, but it now seems that "if (plugin.constructor.name === 'GenerateSW')" is never checked, and so "return new WorkboxWebpackPlugin.InjectManifest" is never called.

Would you have any idea of how I could solve this ?

I looked for breaking changes between Workbox 5 and 7 but didn't see anything about GenerateSW, maybe I missed it ?

0 Answers0