Add new `sourceRootDir` setting
See original GitHub issueTypeScript Version: 3.5.1
Search Terms: sourceRoot, sources, sourcemap
Code
-
Create a module like:
src/nested/foo.ts
-
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:
- Created 4 years ago
- Reactions:5
- Comments:20 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
@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! 😃