DenoDDeno
Powered by
adoublefA
Denoβ€’3y agoβ€’
3 replies
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
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
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);
});
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);
});
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Does `deno bundle` have a TypeScript API?
stephenSstephen / help
8mo ago
Does Fresh have a global error handler?
Deno AI HelperDDeno AI Helper / help
2y ago
Make deno.serve handler asynchronous
KayKKay / help
3y ago
deno bundle does not tree shake
duesabatiDduesabati / help
3mo ago