Skip to content

Basename is not set when using client.baseDir #3253

@infomiho

Description

@infomiho

Describe the bug
Ever since we migrated to React Router 6 in 0.15.0 we weren't setting the basename property of the BrowserRouter which was required for client.baseDir to work.

Old React Router 5 code: https://github.com/wasp-lang/wasp/blob/v0.14.2/waspc/data/Generator/templates/react-app/src/router.tsx#L29C11-L29C19

New React Router 6 missing the option: https://github.com/wasp-lang/wasp/blob/v0.15.0/waspc/data/Generator/templates/react-app/src/router.tsx#L45

To Reproduce
Steps to reproduce the behavior:

  1. Set the client.baseDir option
  2. Deploy web-app and serve from sub-directory (e.g. deploying to Github Pages

Expected behavior
The web-app should work from the sub-directory.

What happens

Deployed our web-app to Github Pages with the sub-directory /github-pages-test-wasp.

Image
{
  "status": 404,
  "statusText": "Not Found",
  "internal": true,
  "data": "Error: No route matches URL \"/github-pages-test-wasp/\"",
  "error": {}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingshouldfixWe should do/fix this at some point

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions