CRA v4 switch from GenerateSW to InjectManifest not supported - workaround
nealeu opened this issue · comments
In facebook/create-react-app#9205, they switched to InjectManifest, yet at https://github.com/arackaf/customize-cra/blob/master/src/customizers/webpack.js#L64 we have
export const adjustWorkbox = adjust => config => {
config.plugins.forEach(p => {
if (p.constructor.name === "GenerateSW") {
adjust(p.config);
}
});
return config;
};
This needs amending to support adjusting the InjectManifest config which people needing to work around this issue can do by using the following code locally instead of importing adjustWorkbox:
export const adjustWorkbox = adjust => config => {
config.plugins.forEach(p => {
if (p.constructor.name === "InjectManifest") {
adjust(p.config);
}
});
return config;
};