Skip to content

inconsistencies with routing patterns with single page app mode (wrangler/vite) #9362

Closed
@threepointone

Description

@threepointone

What versions & operating system are you using?

MacOS, [email protected], @cloudflare/[email protected]

Please provide a link to a minimal reproduction

https://github.com/threepointone/test-wrangler-vite-spa-routing-patterns

Describe the Bug

There are some bugs with routing patterns with both wrangler and the vite plugin when run in "singlae page app mode". I made a repro here https://github.com/threepointone/test-wrangler-vite-spa-routing-patterns, but including the results in this issue as well.

Assume we have an assets directory that looks like this:

public/
  index.html
  xyz.html
  abc/
    index.html
    def.html

with a configuration (as in wrangler.jsonc) that looks like this:

{
  // ...
  "assets": {
    "directory": "public",
    "not_found_handling": "single-page-application"
  }
}

Here's a table of paths, expected files to be loaded, and what files actually get loaded.

Path Expected Actual (wrangler) Actual (vite)
/ index.html index.html ✅ index.html ✅
/xyz xyz.html xyz.html ✅ index.html ❌
/xyz/asdasd index.html index.html ✅ index.html ❌
/abc/ abc/index.html abc/index.html ✅ index.html ❌
/abc/def abc/def.html abc/def.html ✅ index.html ❌
/abc/def/ghi abc/index.html index.html ❌ index.html ❌

Please provide any relevant error logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't workingvite-pluginRelating to the `@cloudflare/vite-plugin` packagewranglerRelating to the Wrangler CLI tool

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions