Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

SW not serving precached files #1210

@0xd61

Description

@0xd61

Describe the bug
The serviceworker does not serve cached files because of a missing "/" in the filenames of the cached-variable

Logs
image

To Reproduce
Run npx degit "sveltejs/sapper-template#rollup" my-app and set a breakpoint in the serviceworker.

Expected behavior
The serviceworker should find the cached files and return them.

Information about your Sapper Installation:

  • Your browser and the version: Chromium Version 81.0.4044.138 (Developer Build) (64-bit)

  • Your operating system: Voidlinux Kernel 5.4.40_1

  • Sapper version 0.27.13

  • Svelte version 3.22.3

  • Whether your application uses Webpack or Rollup: Happens with both templates.

Severity
annoying

Workaround
My current workaround is to prepend a "/" for the filenames in the cached variable:

// `shell` is an array of all the files generated by the bundler,
// `files` is an array of everything in the `static` directory
const to_cache = shell.concat(files);
//const cached = new Set(to_cache);
const cached = new Set(to_cache.map(filename => `/${filename}`));

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions