fix: try to address loading typescript from a compiled binary to no avail: https://github.com/denoland/deno/issues/18327#issuecomment-2989449015

This commit is contained in:
Andy Burke 2025-06-19 17:29:45 -07:00
parent 62761723d4
commit b0548f05cc
3 changed files with 11 additions and 5 deletions

View file

@ -69,10 +69,15 @@ export default async function handle_typescript(request: Request): Promise<Respo
'/';
const import_path = new URL('file://' + entry.path, import.meta.url).toString();
const module: ROUTE_HANDLER = await import(import_path) as ROUTE_HANDLER;
const pattern = new URLPattern({ pathname: route_path });
routes.set(pattern, module);
try {
const module: ROUTE_HANDLER = await import(import_path) as ROUTE_HANDLER;
const pattern = new URLPattern({ pathname: route_path });
routes.set(pattern, module);
} catch (error) {
console.error(`Error mounting module ${import_path} at ${route_path}\n\n${error}\n`);
}
}
}