Hi there,
Is there a way to bundle my pages retrieved by FileSystemRouter at compile time in the compiled executable ?
I tried with Macro, but can't work because of promises :
// file -> /src/server.tsx
import { bundledRouter } from './utils/bundledRouter' with { type: 'macro' }
bundledRouter().then(([router, routes]) => {
console.log(router)
})
// file -> /src/utils/bundledRouter.ts
export async function bundledRouter() {
const router = new Bun.FileSystemRouter({
style: "nextjs",
dir: "./src/pages/",
assetPrefix: "/static/"
})
const routes = Object.entries(router.routes).reduce<any>(async (acc, [key, value]) => {
return {...(await acc), [key]: await import(value)}
}, {});
return await Promise.all(routes)
}