Skip to content

Support MPAs / prerendering #17

Description

@xavierchanth

I setup prerendering but convex keeps serving the same index.html file for EVERY route, even with spa fallback turned off.

What I mean by this is my dist/ looks something like:

/index.html
/foo/index.html
/bar/index.html

This code:

registerStaticRoutes(http, components.selfHosting, {
  pathPrefix: "/",
  spaFallback: false,
});
registerStaticRoutes(http, components.selfHosting, {
  pathPrefix: "/foo",
  spaFallback: false,
});
registerStaticRoutes(http, components.selfHosting, {
  pathPrefix: "/bar",
  spaFallback: false,
});

has the following behavior:

/ -> renders /index.html
/foo -> renders /index.html
/bar -> renders /index.html
/foo/index.html -> 404
/bar/index.html -> 404

Whereas I would like the behavior:

/ -> renders /index.html
/foo -> renders /foo/index.html
/bar -> renders /bar/index.html

Made a prototype for a new flag here, but it's not tested:

https://github.com/xavierchanth/static-hosting/tree/patch-1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions