Skip to content

Support deploying under a non-root base path (e.g. GitHub Pages) #20

@brianjenkins94

Description

@brianjenkins94

almostnode currently assumes the app is served from the origin root (/). Deploying to a sub-path (e.g. a GitHub Pages site at https://user.github.io/<repo>/<app>/) breaks in several places because the service worker path, scope, and virtual-server matching are all hardcoded to root. I got it working by patching the built SW + registration at build time, but it'd be great to support this first-class.

A "base-aware" mode would cover all of this:

  • plugin emits __sw__.js into the build, and
  • SW + registration derive their base from self.location / import.meta.env.BASE_URL instead of assuming /, with a configurable scope, and
  • the referer-fallback scoped to in-app requests only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions