question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Main webpack output bundle no longer pre-cached in V5

See original GitHub issue

Library Affected: workbox-precaching, V5 Alpha 2

Browser & Platform: webpack

Issue or Feature Request Description: My main output file from webpack is no longer being included in the precache manifest after upgrading from V4 to V5. Here are the js assets that webpack outputs to my filesystem:

1.index_bundle.js
2.index_bundle.js
editor.worker.js
index_bundle.js
typescript.worker.js

Here’s the cache manifest file that workbox v4 would output. Note that index_bundle.js is included.

self.__precacheManifest = (self.__precacheManifest || []).concat([
  {
    "revision": "c4bddb31ace86dbd7f567b40cb5a0bfd",
    "url": "index.html"
  },
  {
    "revision": "6180120d73972d5b0c2a",
    "url": "js/1.index_bundle.js"
  },
  {
    "revision": "96df8d6da3d4ae7f5051",
    "url": "js/2.index_bundle.js"
  },
  {
    "revision": "1fe07dc59a6c1a48c4fd173280d8ba88",
    "url": "js/editor.worker.js"
  },
  {
    "revision": "85e7395985be8377cdee",
    "url": "js/index_bundle.js"
  },
  {
    "revision": "b74c9f976a468d7407e2346e516585b8",
    "url": "js/typescript.worker.js"
  }
]);

Here’s the precache manifest that V5 outputs (inline in sw.js):

self.__WB_MANIFEST = [
  { revision: "c4bddb31ace86dbd7f567b40cb5a0bfd", url: "index.html" },
  { revision: "d4059a63ae8430589d9ddb5a4b1be0eb", url: "js/1.index_bundle.js" },
  { revision: "208f42a5bd2761181e6078e893d5dad7", url: "js/2.index_bundle.js" },
  { revision: "1fe07dc59a6c1a48c4fd173280d8ba88", url: "js/editor.worker.js" }
];

index.bundle.js is missing here (and also typescript.worker.js I just noticed). The only change on my end is upgrading workbox. Not sure what to do to further debug why this is the case any advice is appreciated.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
jeffposnickcommented, Aug 19, 2019

Thanks for the reproduction steps.

It might be hard to spot amongst all the other WARNING messages, but the following is logged and explains what’s going on:

WARNING in index_bundle.js is 2.1 MB, and won't be precached. Configure maximumFileSizeToCacheInBytes to change this limit.

WARNING in typescript.worker.js is 4.11 MB, and won't be precached. Configure maximumFileSizeToCacheInBytes to change this limit.

As the message explains, you can configure maximumFileSizeToCacheInBytes to a value larger than the size of those assets if you want to precache them. (But be aware, of course, that precaching several megabytes unconditionally might not play nicely with devices using low-end connections. You know your user base better than I do, of course.)

2reactions
stefanlicommented, Aug 19, 2019

🤦‍♂️ Argh. Thanks and sorry for taking up your time with this. This is under development so haven’t gotten to code splitting things properly yet. It’s also an offline first desktop app so requirements are a bit more relaxed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Caching - webpack
This guide focuses on the configuration needed to ensure files produced by webpack compilation can remain cached unless their content has changed. Output...
Read more >
Upgrade to Webpack 5 failing - node.js - Stack Overflow
0.0 no longer allows custom properties in configuration. Loaders should be updated to allow passing options via loader options in module.rules.
Read more >
Migrate from Workbox v4 to v5 - Chrome Developers
A guide to migrating from Workbox v4 to v5. ... Node.js versions prior to v8 are no longer supported for workbox-webpack-plugin ...
Read more >
A mostly complete guide to webpack 5 (2020)
Now run again npm run dev and you should see no more errors. ... dist └── main.js. This is your first webpack bundle,...
Read more >
An Annotated webpack 4 Config for Frontend Web…
As web development becomes more complex, we need tooling to help us build modern websites. Here's a complete real-world production example ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found