-
Notifications
You must be signed in to change notification settings - Fork 12.8k
TS 3.0 RC Project References not supporting outDir compiler option #26036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Still hoping for the prioritization of this in 3.1, even if I could not see anything indicating so in the 3.1 RC release notes. Testing the sample project in the earlier mentioned repository with 3.1 RC still does not work as expected. My findings indicate that project references in v3.0 can only be used with TS projects that output compiled JS to same folder as TS source code. |
…ect with project references Fixes #26036
…project references in it instead of decl file path) This also ensures that originalFileName, resolvedPath are set correctly even when we are reusing program structure Fixes #26036
…solve module/typereferences/reference paths in it instead of output decl file path This also ensures that originalFileName, resolvedPath are set correctly even when we are reusing program structure Fixes #26036
Thanks. Looking forward to test this 😃 |
Still this has not been fixed in 3.1.1. Import paths in emitted JavaScript are wrong when outDir compiler option is set (when set to something different than the TypeScript source directory). This fails when using outDir both in the referencing or/and in the referenced project. I see no reason why this cannot be fixed. |
we do not transform module specifiers in output javascript in any condition. We always recommend to use the module specifiers that you intent to use at runtime and then help compiler with that resolution at design time by providing appropriate options |
I am not entirely sure what would be the easiest way to help compiler at design time. Would you be able to show some example, f.ex. based on the structure in my repo https://github.com/josundt/tsprojects-outdirproblem ? |
Refer to this documentation of compiler options for module resolutions. From your example i cant make out what you want to do. In both src and test directory there are two tsconfig files so not sure which one you are looking at. Can you please edit the example so as to you have set options you want. And I can then look at it. |
I just came across the same thing in version 3.3.3. I have yarn workspaces with the following setup:
Unfortunately when building |
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
The text was updated successfully, but these errors were encountered: