Skip to content

Basepath issue with deploy on GitHub pages #2

@nltesown

Description

@nltesown

I've tried to set up the export of a Sapper app and deploy on GitHub pages, with the following file:

name: Build Sapper and Deploy to GitHub Pages
on: [push]
jobs:
  build_deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - name: Build Sapper
        uses: truewebartisans/actions-sapper@master
        with:
          build_mode: "export"
          args: "--legacy"
      - name: Deploy to GitHub Pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          publish_dir: __sapper__/export
          publish_branch: gh-pages
          github_token: ${{ secrets.GITHUB_TOKEN }}

When I push to my GH repo, the action is completed successfully but there is a problem because Sapper pages always add a <base="/"> tag by default, so the static assets and page links all use my_name.github.io instead of my_name.github.io/my_app as base path.

You don't have this problem in you example on https://sapper-action.gh.1wa.co because you serve from the root.

I've tried different things to make it work (--basepath my_app in the export args, adding a base folder name in Sapper's server.js film) but it doesn't solve anything, only moves the problem one folder deeper.

Do you know how it could work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions