Skip to content

${configDir} in paths without baseUrl doesn't work #738

@sloonz

Description

@sloonz

Acknowledgements

  • I read the documentation and searched existing issues to avoid duplicates
  • I understand this is a bug tracker and anything other than a proven bug will be closed
  • I understand this is a free project and relies on community contributions
  • I read and understood the Contribution guide

Minimal reproduction URL

https://github.com/sloonz/tsx-repro

Problem & expected behavior (under 200 words)

Above repro gives :

Error: Non-relative paths are not allowed when 'baseUrl' is not set. Did you forget a leading './'?
    at /tmp/t2/node_modules/get-tsconfig/dist/index.cjs:7:12530
    at Array.map (<anonymous>)
    at /tmp/t2/node_modules/get-tsconfig/dist/index.cjs:7:12416
    at Array.map (<anonymous>)
    at parsePaths (/tmp/t2/node_modules/get-tsconfig/dist/index.cjs:7:12312)
    at Object.createPathsMatcher (/tmp/t2/node_modules/get-tsconfig/dist/index.cjs:7:12853)
    at loadTsconfig (/tmp/t2/node_modules/tsx/dist/register-D46fvsV_.cjs:1:1461)
    at Object.register (/tmp/t2/node_modules/tsx/dist/register-D46fvsV_.cjs:4:1579)
    at Object.<anonymous> (/tmp/t2/node_modules/tsx/dist/cjs/index.cjs:1:473)
    at Module._compile (node:internal/modules/cjs/loader:1734:14)

Obviously tsc has no trouble with it.

Weird thing is that get-tsconfig has no trouble with that repro :

$ node
> console.dir(require("get-tsconfig").parseTsconfig("tsconfig.json"), {depth: null})
{
  include: [ '/tmp/t2/file.ts' ],
  compilerOptions: {
    outDir: './dist',
    paths: { '@/*': [ '/tmp/t2/*' ] },
    Symbol(implicitBaseUrl): '/tmp/t2'
  },
  exclude: [ '/tmp/t2/dist' ]
}

(which is unsurprising, since I made that repro from get-tsconfig unit tests)

Bugs are expected to be fixed by those affected by it

  • I'm interested in working on this issue

Compensating engineering work will speed up resolution and support the project

  • I'm willing to offer $10 for financial support

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions