Meep
Meep2w ago

Dependency tree not resolving properly for deno modules in local filesystem.

Background: I'm working on an application with many custom utilities as dependencies. I have these utilities divided out into smaller deno.json packages for better organization. All of these utility packages are on my local filesystem, and since I'm still working on development and planning still I'm unlikely to publish them at the moment. Some of these utilities depend on eachother and form a tree of package dependencies; all on my local filesystem. Some of the utilities are shared between multiple projects and are kept in a separate generic libs folder on my filesystem. Issue For some reason I'm getting an error when trying to test my application with deno run:
C:\Users\super\meep-tech\projects\Kept\deno\apps\kms> deno task run:dev

Relative import path "@meep/args" not prefixed with / or ./ or ../ and not in import map from "file:///C:/Users/super/meep-tech/libs/ts/deno/tsx/src/tsx.ts"
at file:///C:/Users/super/meep-tech/libs/ts/deno/tsx/src/tsx.ts:3:18
C:\Users\super\meep-tech\projects\Kept\deno\apps\kms> deno task run:dev

Relative import path "@meep/args" not prefixed with / or ./ or ../ and not in import map from "file:///C:/Users/super/meep-tech/libs/ts/deno/tsx/src/tsx.ts"
at file:///C:/Users/super/meep-tech/libs/ts/deno/tsx/src/tsx.ts:3:18
Given these imports in the deno.json files for each package i'd expect it to work as expected: - for @meep/kms (the app which was run)
"imports": {
"@meep/tsx": "../../../../../libs/ts/deno/tsx/src/mod.ts"
},
"imports": {
"@meep/tsx": "../../../../../libs/ts/deno/tsx/src/mod.ts"
},
- for @meep/tsx
"imports": {
"@meep/args": "../args/src/mod.ts",
},
"imports": {
"@meep/args": "../args/src/mod.ts",
},
Any advice on what I'm doing wrong?
5 Replies
Meep
Meep2w ago
As a note; I've also tried workspaces but they don't work because the utility packages aren't nested sadly
bartlomieju
bartlomieju2w ago
It's hard to say without seeing a whole project, but it looks like you're trying to use a separate import map in ea h directory This is not supported outside of workspaces
Meep
Meep2w ago
So... Wait maybe I'm misunderstanding; Doesn't that mean Deno itself can't support nested dependencies for its own native type of packages? If that's true I'm not sure how to work around this tbh .. I guess I should ask then; how is one expected to manage a tree of local dependencies when developing an app in Deno?
bartlomieju
bartlomieju2w ago
I'm not saying that, I can't really advise here unless I can see the project structure and what you're trying to do Most likely you want to use a workspace, but I can't be sure rn
Meep
Meep7d ago
Thanks for the reply to provide more info: The issue is workspaces seem to require a nested folder structure. Here is an example of my folder structure if that helps:
- /meep
- projects
- kms
- apps
- client*
- libs
- core*
- bbnf
- libs
- parser*
- libs
- deno
- iter*
- guards*
- types*
- ...etc
- /meep
- projects
- kms
- apps
- client*
- libs
- core*
- bbnf
- libs
- parser*
- libs
- deno
- iter*
- guards*
- types*
- ...etc
My issue with workspaces comes when both meep/projects/kms/libs/core and meep/projects/bbnf/libs/parser need to use the packages in the meep/libs/deno folder. The only way I could see it working without some kind of nested workspaces or allowing workspace folders to be non-nested is if I make a deno.json file for each project but put it in the root meep/ folder which seems like an incorrect place for project files~