Description
Not sure if this should be posted here or SWPrecacheWebpackPlugin, but I figured it should be documented somewhere since it was rough to diagnose.
Description
When the webpack JavaScript bundle becomes to large, yarn build
throws a warning:
Skipping static resource "/home/austin/cra-swcache-broken-repro/build/static/js/main.4f79027e.js" (2.77 MB) - max size is 2.1 MB
as is mentioned in #2433. This seems to cause SWPrecacheWebpackPlugin to skip adding the bundle to the list of assets it will cache, but this is not clear from the error message that this is the case. This breaks any offline functionality an app might have.
Expected behavior
Either a warning about file size and the file is still added to the cache, or a more explicit warning that this error is coming from or causing an error in SWPrecacheWebpackPlugin and that the resource won't be cached.
Actual behavior
As seen in the snippet bellow, there is no main.js in the generated service-worker.js.
"use strict";function setOfCachedUrls(e){return e.keys().then(function(e){return e.map(function(e){return e.url})}).then(function(e){return new Set(e)})}var precacheConfig=[["index.html","8271cbe9809a6bbeca76 83483ce358f0"],["static/css/main.9a0fe4f1.css","3473922d6aed4c20bb69846d6027cacf"],["static/media/logo.5d5d9eef.svg","5d5d9eefa31e5e13a6610d9fa7a283bb"]],cacheName="sw-precache-v3-sw-precache-webpack-plugin-" ...
Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts
: react-scripts@1.0.7node -v
: v7.10.0npm -v
:4.6.1
Then, specify:
- Operating system: Arch Linux
- Browser and version: Google Chrome Version 58.0.3029.110 (64-bit)
Reproducible Demo
(Thanks for all the work you all have put into CRA, it has made my life a lot simpler!)