Skip to content

Deno workspaces that are imported in code can't be resolved by node scripts/cli's #35359

@KrisReal

Description

@KrisReal

Version: Deno 2.8.3

Summary

When you import a Deno workspace, and pass that file to a node cli (jiti for example) through a deno task, the cli will not be able to resolve the workspace module. This is super frustrating for monorepo's that depend on a package exposed cli to generate code based on a .ts config. I would like to avoid having to use a seperate package.json for this module.

Reproduction

deno.json:

{
  "tasks": {
    "auth:generate": "auth generate --config ../auth/src/auth.ts --y --output ./src/auth.schema.ts"
  },
  "nodeModulesDir": "auto"
}

auth.ts

import { env } from "@workspace/env/server"

Then run:

deno task auth:generate

Expected behavior

The script should be able to read the auth.ts file without a problem

Actual behaviour

[#better-auth]: Couldn't read your auth config. Error: Cannot find module '@workspace/env/server'

Why this matters

When a package exposes a CLI, the CLI cannot be used because the module is not symlinked into a node_modules folder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions