I'm using express template.
this is a part of app.ts
app.use(
createRequestHandler({
build: () => import("virtual:react-router/server-build"),
}),
);
when first load, then the import promise being resolved.
in produciton in normally it would take more then 500ms, but 1ms after first hit.
const build = import("virtual:react-router/server-build")
app.use(
createRequestHandler({
build: () => build,
}),
);
just put it on top of app.use()
it's now fast enough.