I just tested TS 3 RC project references in a typical npm package setup with included tests. The tests were set up as a TS project referencing the implementation TS project.
I surprisingly found that project references do not adhere to the outDir compilerOption of referenced or referencing projects, and that the relative paths for module imports in the compiled referencing project's JS files therefore are wrong; paths point to the TS folder, not the compiled output folder.
A somewhat simplified view of my PoC:
- src/
(contains implementation code, TS project REFERENCED by tests)
- dist/
(compiled output from src/; using the outDir compilerOption)
- test/
(tests for implementation code in src/; project REFERENCING src/)
Expected behavior:
Relative paths of module imports in the compiled code for the referencing project should be calculated from:
- relative path from outDir compilerOption of referenced project
- relative path from outDir compilerOption of referencing project
I put up a small repository to demonstrate the problem:
https://github.com/josundt/tsprojects-outdirproblem
PS! I also added this request under the general discussion thread on #25600
I just tested TS 3 RC project references in a typical npm package setup with included tests. The tests were set up as a TS project referencing the implementation TS project.
I surprisingly found that project references do not adhere to the outDir compilerOption of referenced or referencing projects, and that the relative paths for module imports in the compiled referencing project's JS files therefore are wrong; paths point to the TS folder, not the compiled output folder.
A somewhat simplified view of my PoC:
(contains implementation code, TS project REFERENCED by tests)
(compiled output from src/; using the outDir compilerOption)
(tests for implementation code in src/; project REFERENCING src/)
Expected behavior:
Relative paths of module imports in the compiled code for the referencing project should be calculated from:
I put up a small repository to demonstrate the problem:
https://github.com/josundt/tsprojects-outdirproblem
PS! I also added this request under the general discussion thread on #25600