📎 Webclip
LICENSE to kill your PWA
The post explains how a PWA kept serving an old cached version because pre-caching failed on a missing .LICENSE file. The failure came from a 404 on IIS, where the extracted license asset was not configured to be served.
Reading notes#
- A
bad-precaching-responseerror appeared when the app tried to load/static/js/6.20102e99.chunk.js.LICENSE?__WB_REVISION__=e2fc36. - The server had a
.LICENSEfile at that location, but IIS did not support that file type correctly. - The file was created by the build, which scraped license comments from bundled files into
6.20102e99.chunk.js.LICENSE. - The problem was traced to
terser-webpack-plugin, which extracts license files by default. - The app was an ejected
create-react-appproject, so the build settings could be changed. - The fix was to set
extractComments: falseinTerserPlugininsidewebpack.config.js. - A later update says the plugin behavior should change to emit
.LICENSE.txtfiles by default, which would be friendlier to IIS and similar servers.
