-
Notifications
You must be signed in to change notification settings - Fork 742
Open
Description
When changing base path from root, the client-entry file cannot be found, returns 404 error, when visiting the page in the browser in dev mode. In production build, client-entry is found, but stylesheet imported by client-entry is not found.
Steps to Reproduce
- Create new Fresh project:
deno run -Ar jsr:@fresh/init- Change base path in
main.tsandvite.config.ts:
main.ts
import { App, staticFiles } from "fresh";
import { define, type State } from "./utils.ts";
export const app = new App<State>({
basePath: "/ui"
});
app.use(staticFiles());
// Pass a shared value from a middleware
app.use(async (ctx) => {
ctx.state.shared = "hello";
return await ctx.next();
});
// this is the same as the /api/:name route defined via a file. feel free to delete this!
app.get("/api2/:name", (ctx) => {
const name = ctx.params.name;
return new Response(
`Hello, ${name.charAt(0).toUpperCase() + name.slice(1)}!`,
);
});
// this can also be defined via a file. feel free to delete this!
const exampleLoggerMiddleware = define.middleware((ctx) => {
console.log(`${ctx.req.method} ${ctx.req.url}`);
return ctx.next();
});
app.use(exampleLoggerMiddleware);
// Include file-system based routes here
app.fsRoutes();vite.config.ts
import { defineConfig } from "vite";
import { fresh } from "@fresh/plugin-vite";
import tailwindcss from "@tailwindcss/vite";
export default defineConfig({
base: "/ui/",
plugins: [fresh(), tailwindcss()],
});- a.
Run in dev:
deno task dev- a. See 404 errors for client-entry
- b.
Run in prod:
deno task build
deno task start- b. See 404 error for stylesheet, but client-entry is found. It is looking for it at
http://localhost:8000/assets/client-entry-ByNlewOz.css?__frsh_c=

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels