1

First and foremost, I understand how tsconfig.json works in general, but not completely. OK, here's my problem...

I am using the tsc command line to compile my *.tsx files in a /lib folder. Everything works fine, I can import the libraries and run my project.

When I am using my IDE (WebStorm), I can navigate to the definition doing CTRL+Click. However this brings me to the limited definition generated by the tsc command line. I would like to be redirected to my source file (the one that is within the /src folder).

My library structure is the following:

/lib
/src
tsconfig.json

My tsconfig.json file contains the following:

{
    "compilerOptions": {
        "target": "es2015",
        "module": "commonjs",
        "jsx": "react",
        "lib": [
            "es2015", "dom"
        ],
        "declaration": true,
        "declarationMap": true,
        "sourceMap": true,
        "strict": true,
        "moduleResolution": "node",
        "esModuleInterop": true,
        "rootDir": "./",
        "baseUrl": "./",
        "paths": {
            "@project/*": ["./packages/*/src"],
            "*": ["node_modules", "packages"]
        },
        "typeRoots": [
            "./packages/@types"
        ],
        "resolveJsonModule": true
    },
    "include": [
        "packages"
    ],
    "exclude": [
        "node_modules",
        "**/*.spec.ts",
        "packages/**/dist"
    ]
}

Objective:

I want to compile the /src folder and thereafter being able to navigate to the original sources by doing a CTRL+CLICK on the component in my IDE (WebStorm) and also being able to debug the original source in Chrome.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Chololoco
  • 3,140
  • 1
  • 21
  • 24
  • [Here is the same question about VS Code](https://stackoverflow.com/questions/48711065/go-to-the-typescript-source-file-instead-of-the-type-definition-file-in-vs-code) – artem Jul 21 '19 at 15:08
  • It is recommended to exclude the build folder (`lib` in your case) from the project - to do that, right-click on the folder in the Project view and select Mark as Excluded. – Ekaterina Prigara Jul 22 '19 at 14:04

0 Answers0