adoublefA
Deno3y ago
adoublef

Does calling `bundle` inside a handler make sense?

hey all I wanted to understand if this is smart to do. I am using the
cacheRoot
option and wanted to know if that affects the way the code is executed here. As its being called inside a handler I am unsure if this is going to compile everytime or does the
cacheRoot
option speed that up?

app.get("/index.js", async (c) => {
  const { code } = await bundle(
    new URL("./components/mod.ts", import.meta.url),
    { cacheRoot: Deno.cwd() },
  );
  return c.text(code);
});
Was this page helpful?