-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
"Error: Debug Failure." when building a TypeScript library that depends on another TypeScript library. #56179
Comments
Do you have a version of this that doesn't involve nx's build system? They wrap TS so a crash like this can be caused by their code. |
Hey Jake, thanks for the quick reply. I tried running |
I suspect that this is something in nx, yes, though the backtrace doesn't appear to be long enough to figure that out. The line of code above is in |
This issue has been marked as "External" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
I had this error coming randomly using 'nx', actually in the middle of migration to it
/.../typescript/lib/tsc.js:1321
throw e;
^
Error: Debug Failure.
at resolveExternalModule (/.../node_modules/typescript/lib/tsc.js:46519:37)
at resolveExternalModuleNameWorker (/.../node_modules/typescript/lib/tsc.js:46478:61)
at resolveExternalModuleName (/.../node_modules/typescript/lib/tsc.js:46475:12)
at getSymbolAtLocation (/.../node_modules/typescript/lib/tsc.js:81623:18)
at Object.getSymbolAtLocation (/.../node_modules/typescript/lib/tsc.js:43355:21)
at getReferencedFilesFromImportLiteral (/.../node_modules/typescript/lib/tsc.js:119559:28)
at getReferencedFiles (/.../node_modules/typescript/lib/tsc.js:119570:44)
at Object.create (/.../node_modules/typescript/lib/tsc.js:119639:31)
at createBuilderProgramState (/.../node_modules/typescript/lib/tsc.js:119925:30)
at createBuilderProgram (/.../node_modules/typescript/lib/tsc.js:120738:17) not ruling out that using tsc directly is a bad idea, I don't know 'nx' properly yet |
did you find a solution to the problem? |
🔎 Search Terms
typescript error debug failure
typescript Debug.checkDefined(tryExtractTSExtension(moduleReference));
typescript checkDefined
A related bug report is here:
#52182
However, that bug was fixed in January 2023 and I'm seeing this issue with TypeScript v5.1.6, which released on July 5, 2023.
🕗 Version & Regression Information
⏯ Playground Link
No response
💻 Code
I've created an MCVE repo here:
https://github.com/zkWildfire/tsc-nx
The issue can be repro'd with a total of two source files (plus index.ts files). The repo is configured with a VSCode devcontainer, so hopefully it won't be a problem to repro the issue locally. Full instructions are provided in the repo's readme.
In summary, the issue occurs when importing a type from a subdirectory of a library, e.g.
import { Foo } from "@mylib/foo"
is fine butimport { Foo } from "@mylib/foo/bar"
breaks. In my MCVE, the bug appears as this error message when runningnx build foo
:I'm relatively new to TypeScript and nx so I'm not sure if I've done something wrong with the project configuration. The change that I made to the
tsconfig.base.json
file was to add this line:Even if that's an issue though, the TypeScript compiler should still be failing with a regular error message rather than an internal compiler check error.
🙁 Actual behavior
The TypeScript build fails due to an internal compiler debug check.
🙂 Expected behavior
The build should complete successfully.
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: