Skip to content
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

fix: prevent error when the script tag is removed in nodenext projects #2635

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

jasonlyu123
Copy link
Member

Part of #2538. The problem is becuase we're patching impliedNodeFormat in module resolution. When we can't even parse the script tag the module resolution won't happen and the impliedNodeFormat won't be patched. This causes TypeScript to try to clear the old source file and trigger the Debug.assert.

I also found another situation that would trigger the same Debug.assert but I haven't found a way to fix it. Might have to open an issue on TypeScript for that one. At least we can get this easier one fixed.

I also can't figure out the exact condition that triggers #2534 (comment). From the typescript source code, it makes no sense this would happen. The error fixed in this PR might cause the document registry to update but not the language service. So maybe #2534 (comment) is caused by the weird state after the error but I still can't find the exact situation.

@jasonlyu123
Copy link
Member Author

Oh, that was embarrassing 😅. I thought I fixed it. Back to the drawing board.

@jasonlyu123 jasonlyu123 marked this pull request as draft December 23, 2024 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant