wRadionW
Denoβ€’12mo agoβ€’
1 reply
wRadion

Import local package in sub folder workspace

Hello! I'm trying to understand how the workspace/local imports work.

I've managed to follow along with the simple add/substract example from the docs. But I have another folder structure than this in my project. Imagine something as follows:
root
|- add
    |- deno.json // @scope/add
    |- index.ts
|- substract
    |- deno.json // @scope/substract
    |- index.ts
|- maths
    |- geometry
        |- deno.json
        |- index.ts // doesn't find @scope/add or @scope/substract
    |- deno.json // workspace: ["./geometry"]
|- deno.js // workspace: ["./add", "./substract", "./maths"]


Now if I wanna import add or substract inside my geometry module, it doesn't find it. But if I move everything one workspace up (move geometry directly in the root workspace) then it works.

I just have might the whole workspace/module thing wrong, so I would like to know how it works and what's the best way to fix this. Thanks!
Was this page helpful?