-
Notifications
You must be signed in to change notification settings - Fork 12.8k
tsc --build with rootDir and outDir is compiling files within a project in alphabetical order, breaking imports #25864
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
I was just hit by this as well - exact same issue, and the reproduction is bang on what I'm seeing. Let me know if there's anything I can do to help expedite this (PR, tests, another repro, test a beta, etc.). Thanks! |
This is broken in 3.8.0-beta |
This is broken. Again. Version 3.7.5 and 3.7.4. |
This is broken in 3.7.5 |
the same in 3.7.2 |
I had the same problem but it stopped when I took care of the following. (I'm on v3.8.3 btw).
My tsconfigs look like this: {
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist/lib",
"composite": true,
"baseUrl": "../",
"paths": {
"my-dependency": [
"./my-dependency/dist/lib/index"
],
"my-dependency/*": [
"./my-dependency/dist/lib/index/*"
]
},
"tsBuildInfoFile": "tsconfig.tsbuildinfo"
},
"include": ["src"],
"exclude": [
"**/*.test.ts",
"**/*.test.tsx"
],
"references": [
{
"path": "../my-dependency/tsconfig.json"
}
]
} |
I am on This breaks the project references feature and makes it entirely unusable. |
@desmap you would need to open new issue with exact repro steps to be able to investigate this. The repro in this issue seems to be working correctly. |
@sheetalkamat Unfortunately I'm not in a position to set up a repro project, but in my case, this is happening when the build script is running within a docker image build. I assume it has to do with the way the output file is compared with an existing tsbuildinfo file that has been copied or volume mounted. That's speculative, so I'll try to get an exact answer once I work around the issue. |
Can a resolution of this to be not to use tsbuildinfo if the outDir doesn't exist? |
Currently only working after a successful run of 'npm run clean && npm install && npm run build' but if you remove the dist folder and then try to build again, tsc -b doesn't build deps in order. seems similar to microsoft/TypeScript#25864
TypeScript Version: 3.1.0-dev.20180721
Search Terms: tsc build project reference rootDir outDir
Code
Brief summary: When
rootDir
andoutDir
are involved as well as a project reference, source files within an individual project that has a dependency project would be compiled in alphabetical order. The consequence is that anA.ts
that imports fromB.ts
will fail withOutput file '.../B.d.ts' has not been built from source file '.../B.ts'
but if I renameA.ts
toC.ts
everything works, as does removing the project reference or not using root/outDir.The setup is hard to fully convey through text so here's a zip: repro.zip.
npm install
thennpm run build
to trigger the issue.Expected behavior: Compiles both
main
andother
projects successfully regardless of the names of the source files.Actual behavior:
error TS6305: Output file '.../B.d.ts' has not been built from source file '.../B.ts'.
The text was updated successfully, but these errors were encountered: