#about prod & dev dependencies in deno projects

9 messages · Page 1 of 1 (latest)

acoustic willow
#

What are best practices for managing prod/dev dependencies in a clear separate manner with deno?

  1. Without workspaces?
  2. With workspaces?
  3. Using import_map.json (both cases)?
  4. Is a separate dev_import_map.json recommended?

Please help me solve it. Thanks!"

bitter shard
#

None of this. The way dependencies work in Deno is that only the ones get used that are referenced from your entry point. So when you do deno run foo.ts only the dependencies reachable from foo.ts will be installed during deployment. Or in other words: Put all your dependencies into the "imports" section in deno.json and just make sure that you don't import dev deps in prod code

acoustic willow
bitter shard
acoustic willow
acoustic willow
acoustic willow
#

@bitter shard Can you please help us here?

glass falcon
# acoustic willow can't we maintain two diff import_map.json like `prod_import_map.json` & `dev_im...

You can do that sure OR have a separate entry point for dev stuff. Then all dependencies can live in one import map. I personally prefer the latter approach. As marvinh said, those import map dependencies are only defined in the import map - they are not automatically used or loaded so defining stuff there is "free". They are actually loaded only if your entry point specifically needs (imports) it. So if your prod entry point does not import dev stuff, none of the dev stuff is loaded.

acoustic willow