cameronm
cameronm3mo ago

nodeModulesDir with deno workspaces

Hi there, Running into an issue with deno workspaces. I have created an apps and packages directory in the root of my workspace. Inside apps I have a web directory containing a sveltekit project. I have the root deno.json setup like this
{
"workspace": ["./apps/web"],
"nodeModulesDir": "auto"
}
{
"workspace": ["./apps/web"],
"nodeModulesDir": "auto"
}
When I run deno install, from the apps/web directory, the node_modules folder gets created in the root project directory instead of the apps/web directory. If I remove the workspace config from the above code snippet like so:
{
"nodeModulesDir": "auto"
}
{
"nodeModulesDir": "auto"
}
The node_modules folder gets created in the app/web directory as expected. The documentation is a little sparse, and am wondering if this is expected behaviour. Wondering if since this folder (apps/web) is not exporting any code, only consuming from other shared packages, that it should not be included in the workspace config in root deno.json ie. workspace config should only include paths to shared packages that are exporting code.
1 Reply
cameronm
cameronmOP3mo ago
GitHub
node_modules installs to wrong directory in monorepo · Issue #26126...
Version: Deno 2.0.0 I have a simple monorepo setup with two folders deno.json deno.lock packages/some-package apps/web // deno.json { "nodeModulesDir": "auto", "workspace&q...

Did you find this page helpful?