infinite refreshing page auto when i add GenerateSW to the webpack production
Hi , i want to refactor my project to the pwa and i checked for many times and tested, when i add this code to the webpack production and when serve it, my page refresh many times auto in the loop ,but i remove that code and I saw it works correctly , it seems maybe there is no problem in the react app logic
webpack.prob
plugins: [
// new BundleAnalyzerPlugin(),
// new FriendlyErrorsWebpackPlugin(),
new MiniCssExtractPlugin({
filename: '[name].' + language + '.css',
chunkFilename: '[id].' + language + '.css',
filename: `static/css/[name].[contenthash].css`,
chunkFilename: `static/css/[id].[contenthash].css`
}),
new GenerateSW({
swDest: 'sw.js',
clientsClaim: true,
skipWaiting: true
}),
]
main index.ts
import register from './serviceWorker';
import './styles/main.scss';
ReactDOM.render(
<Root>
<Routs />
</Root>
,
document.getElementById('root')
);
register();
and I used service worker of create-react-app
I don't think we can address this extra log message, unfortunately. workbox-google-analytics works by adding in the BackgroundSyncPlugin to some routes that match Google Analytics pings, and the BackgroundSyncPlugin is invoked whenever there's a failure to transmit the request. So we need that failure to happen, and it can't be caught and silently ignored.