Skip to content

Typescript path aliases #144

@dennemark

Description

@dennemark

Describe the bug

Hi,
I just migrated from tsup to tsdown and it seems like tsdown is not recognising my path aliases. When building it states:
[UNRESOLVED_IMPORT] Warning: Could not resolve '@shared/some/path' in shared/another/path.ts
I am setting a custom tsconfig location in my tsdown config.
tsconfig: './api/tsconfig.json'
in it i have these settings:

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "verbatimModuleSyntax": true,
    "baseUrl": ".",
    "paths": {
      "@api/*": ["./*"],
      "@shared/*": ["../shared/*"]
    }
  },
  "include": ["./**/*", "../shared/**/*"]
}

So it seems like an import of @shared/another/path within @api works. But then from there it cannot import @shared/some/path anymore.

in the attached repository, run pnpm install pnpm build

Reproduction

https://github.com/dennemark/tsdown-path-aliases

System Info

System:
    OS: Linux 6.11 Ubuntu 24.10 24.10 (Oracular Oriole)
    CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
    Memory: 12.95 GB / 30.22 GB
    Container: Yes
    Shell: 5.2.32 - /bin/bash
  Binaries:
    Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
    pnpm: 10.6.2 - ~/.local/share/pnpm/pnpm

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions