Giter Club home page Giter Club logo

parcel-serviceworker-manifest-bug's Introduction

Reproducing

$ git clone https://github.com/luckygerbils/parcel-serviceworker-manifest-bug
$ cd parcel-serviceworker-manifest-bug
$ npm install
$ npx parcel build src/index.html

Note the output includes two index.{hash}.js files, both of which are referenced by the built dist/index.html:

✨ Built in 1.75s

dist/index.html              256 B    643ms
dist/index.086234c1.js    98.88 KB    236ms
dist/service-worker.js       183 B    593ms
dist/index.881f056f.js     1.07 KB    236ms

dist/index.html (manually formatted for this readme)

<!doctype html><html lang="en">
<head>
  <meta charset="utf-8">
  <script type="module" src="/index.881f056f.js"></script>
  <script type="module" src="/index.086234c1.js"></script>
</head>
<body> <h1>Hello, World!</h1> </body>
</html>

However only one of these index.js files is included in the generated service worker manifest:

$ grep 'Service Worker manifest is' dist/service-worker.js
console.log("Service Worker manifest is",["/index.html","/index.086234c1.js"]);//# sourceMappingURL=service-worker.js.map

Since the other file isn't included, it isn't cached by a service worker using this manifest to prepopulate the cache (as in the docs here) and so this file will be missing if the website is reloaded offline.

This appears to only happen if the bundle size is greater than ~100KB (presumably code splitting is coming into effect then)

parcel-serviceworker-manifest-bug's People

Contributors

luckygerbils avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.