DenoDDeno
Powered by
NatdmN
Denoβ€’11mo agoβ€’
5 replies
Natdm

Deno Monorepo with nested applications and packages

I'm trying to move a node monorepo from NPM to Deno. It's got a set of applications in a directory called
services
services
, and set of libraries used by said services in
packages
packages
. These are all independent, and are registered to the apps workspace (
@example
@example
) for now. eg: if a service
myapp
myapp
registered as
@example/myapp
@example/myapp
wanted packages/utils, it'd import
@example/utils
@example/utils
and it'd find it within packages.

I'm trying to do the same in NPM but it seems like everything has to be flat, at the root. Am I not able to register workspaces that are deeper than the root directory?

I've got
/packages/foo/deno.json
/packages/foo/deno.json
and
packages/foo/mod.ts
packages/foo/mod.ts
with a funciton exported. the deno.js has the following contents:

{
  "name": "@example/foo",
  "exports": "./mod.ts",
  "version": "1.0.0"
}
{
  "name": "@example/foo",
  "exports": "./mod.ts",
  "version": "1.0.0"
}


The root project has this deno.json:
{
  "workspace": [
    "./services/api",
    "./packages/foo"
  ]
}
{
  "workspace": [
    "./services/api",
    "./packages/foo"
  ]
}


I'm unable to import
@example/foo
@example/foo
in API, as it says ..

error: Relative import path "@example/foo" not prefixed with / or ./ or ../ and not in import map from "file:///app/mod.ts"
error: Relative import path "@example/foo" not prefixed with / or ./ or ../ and not in import map from "file:///app/mod.ts"


The goal is to run these in docker containers in skaffold.
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Installing packages locally with Deno
fcrozatierFfcrozatier / help
15mo ago
Problems with Nested deno.json in Deno Workspaces
staytuned_teamSstaytuned_team / help
12mo ago
Error With Deno Command Installing JSR Packages
CharCChar / help
16mo ago
Deno: How to import npm scoped packages with @ in deno?
Alex AdventAAlex Advent / help
3y ago