question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add new `sourceRootDir` setting

See original GitHub issue

TypeScript Version: 3.5.1

Search Terms: sourceRoot, sources, sourcemap

Code

  1. Create a module like: src/nested/foo.ts

  2. Use the following tsconfig.json with tsc:

{
  "include": ["src"],
  "compilerOptions": {
    "baseUrl": ".",
    "outDir": "dist",
    "sourceMap": true,
    "sourceRoot": "src"
  }
}

Expected behavior:

Inside nested/foo.js.map, the sourceRoot should be ../src/ instead of src/. Otherwise, the paths in the sources array cannot be found.

Actual behavior:

The sourceRoot is src/ regardless of nesting.

Playground Link: N/A

Related Issues: None

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:5
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
RyanCavanaughcommented, Feb 4, 2022

This one’s been around a long while and we haven’t yet seen the quantity of feedback that would justify further complicating the file resolution process.

1reaction
misticcommented, Jun 22, 2021

@raijinsetsu we don’t have that level of control on Bazel and honestly I dont want to create a new symlink for each package target folder. Developing on windows is already slower and symlinks/junctions there are always painful. What we really need is that sourceRoot behaves like rootDir and calculates the nested relative paths correctly accordingly the value passed on the setting. In alternative a new sourceRootDir param will also work okay! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

TSConfig Option: rootDir - TypeScript
If composite is set, the default is instead the directory containing the tsconfig.json file. When TypeScript compiles files, it keeps the same directory ......
Read more >
'rootDir' is expected to contain all source files - Stack Overflow
As you don't set rootDir property in your tsconfig, Angular CLI seems to internally restrict it to the root of the library you...
Read more >
If not all sources are under rootDir, you only get an error ...
the rootDir is used to build the output folder structure. all files have to be under rootDir for the compiler to know where...
Read more >
Configuring TypeScript: options rootDir, outDir, module, target
Alright, let's start with creating the TypeScript configuration file. ... rootDir is the path to the folder with the source code of the...
Read more >
Source is root dir of msi, no matter what I do. - ITNinja
When I add a new folder in INSTALLDIR and place an uncompressed file in the new folder... IS will automatically create the source...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found