microsoft / microsoft/TypeScript

compilerOptions.paths to support relative and absolute paths

Open
#10,688 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TypeScript Version: 2.0.2

Code

{
  "compilerOptions": {
    "paths": {
      "./moment": ["node_modules/moment/moment.d.ts"],
      "/foo/bar/baz": [ "some/other/path/for/compiler"]
    }
  },

Expected behavior:
I expect (need) to be able to redirect the compiler for any module, not just 'non relative' paths. I'm deploying to a runtime environment that requires me to use relative or absolute paths, but I need the compiler to look to different locations when building locally.

Actual behavior:
The compiler seems to ignore any compilerOption.paths setting which starts with / or ./

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided compilerOptions.paths configuration and the relative and absolute module keys. Trace the compiler's path-resolution entry point to determine why those keys are ignored. Done means relative and absolute paths are redirected as described while existing non-relative path behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.