Skip to content

The alias path package in independent config file is invalid #395

Description

@apades

Clear and concise description of the problem

Project tsconfig

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@root/*": ["src/*"]
    }
}

tsdown.ts

import { defineConfig } from 'tsdown'
import { omit } from '@root/utils'

export default defineConfig({
 // ...
})

thorw error

ERROR  Error: Cannot find module '@root/utils'

Suggested solution

The tsconfig of the project should be loaded in independent config file

Alternative

No response

Additional context

No response

Validations

Activity

  1. added theissue type on Jul 25, 2025
  2. apades commented on Jul 25, 2025

    @apades
    Author

    很奇怪,我把项目clone下来了,dev4跑的是build后的同样报错alias的,dev5直接importtsdown/src/run跑就没事

    Image
  3. apades commented on Jul 25, 2025

    @apades
    Author

    可能我找到问题所在了,tsx把require方法内部的Module._resolveFilename给修改了,用tsx跑会跑到这里,所以才会出现node和tsx跑不同的问题

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Fields

    Priority

    None yet

    Start date

    None yet

    Target date

    None yet

    Effort

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions