patrickalima98P
Deno2y ago
6 replies
patrickalima98

How to optimize imports on deno deploy?

I have a medium project (44 files) deployed on deno deploy, where works.

But, I'm getting inconsistent and sometimes very long cold start times in my deno project, like the attached image.

All my dependencies:
{
  "std/": "https://deno.land/std@0.205.0/",
  "hono/": "https://deno.land/x/hono@v3.9.2/",
  "fs/": "https://deno.land/std@/fs/",
  "dotenv": "npm:dotenv",
  "drizzle-orm": "npm:drizzle-orm",
  "drizzle-kit": "npm:drizzle-kit",
  "drizzle-orm/sqlite-core": "npm:drizzle-kit",
  "@vinejs/vine": "npm:@vinejs/vine",
  "@vinejs/compiler/types": "https://cdn.jsdelivr.net/npm/@vinejs/compiler@2.2.0/build/src/types.d.ts",
  "uuidv4": "npm:uuidv4",
  "rambda": "npm:rambda",
  "hasha": "npm:hasha",
  "upstash_redis": "https://deno.land/x/upstash_redis@v1.14.0/mod.ts",
  "ioredis": "npm:ioredis",
  "dayjs": "npm:dayjs",
  "drizzle-typebox": "npm:drizzle-typebox",
  "@sinclair/typebox": "npm:@sinclair/typebox",
  "drizzle-orm/pg-proxy": "npm:drizzle-orm/pg-proxy",
  "postgres": "https://deno.land/x/postgres@v0.17.0/mod.ts"
}

After some tests, I suspect there is a problem with Imports, because only to import a module with 5x files the deploy is having 2 secs, sometimes 4 secs.

I would like to know if this is normal and if not, How can i fix it?
image.png
Was this page helpful?