Skip to content

Fresh basePath or Vite base property not applied correctly. #3391

@MyDNL

Description

@MyDNL

I want to mount a Fresh app to an Hono instance.

Doing this works:

import { Hono } from "jsr:@hono/hono";
import UI from "./_fresh/server.js";

const app = new Hono();
app.mount('/', UI.fetch); 

Deno.serve(app.fetch);

But i want to mount the fresh app to another path:

app.mount('/ui', UI.fetch); 

Opening http://localhost:8000/ui from browser correctly loads index.html, but all other files/assets return a 404.
That is a relative path issue.
I tried setting "basepath" in FreshConfig, and also "base" in vite.config.ts.
Either way i could not make it work.
I think Fresh is overriding/ignoring the vite's base property.

Trying with the initial fresh counter app.
Opening http://localhost:8000/ui/api/World from browser works and returns "Hello, World!".
Using Deno 2.5.0 and Fresh 2.0.

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