const modules = import.meta.glob("../src/**/*.ts"); export default { async fetch(request) { const { pathname } = new URL(request.url); if (pathname === "/@alias/test") { const { test } = await import("@alias/test"); return test(); } if (pathname === "/optimize-deps/exclude") { const { virtualExport } = await import( // @ts-expect-error virtual module "@playground/module-resolution-excludes" ); return new Response(virtualExport); } const filePath = `${pathname.replace(/^\//, "./")}.ts`; if (modules[filePath]) { const mod = await modules[filePath](); return Response.json((mod as { default: unknown }).default); } const html = `
This app is an example/test for dependencies module resolution being performed in the Cloudflare environment (inside the workerd runtime)