-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Autocomplete crashes when importing from node_modules #31465
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 have started to see this issue too last week. I am using VSCode 1.34.0 on Windows 10 and the TypeScript version is 3.4.5. And for me it also does not work if the type to auto-import is in the same project. |
Hi folks, I'd love to dig into this but this issue could really do with some kind of reproduction case - it looks likely related to a specific node module but without an idea of which. it's really just guess work based on the stack trace which hasn't been enough to re-create it locally.. |
@orta I still have this issue. I tried to create a project which would reproduce the error but so far I've failed. The message with latest VSCode and TypeScript 3.6.3 is:
I tried creating a new project with the exact same dependencies, but it does not produce the same error. I have done a clean install of VSCode, wiped the project from disk and cloned it again, still the same error :(. Is there some way I can get more detailed information on what file it reads when it crashes? |
Ouch, that's tough. For debugging further, I just wrote a doc on how to get the TSServer logs which could hopefully be more useful in trying to understand it from your side. |
I was having this issue recently (same stack trace and symptoms as OP), and was trying to redact enough stuff from our codebase that I could make a shareable repro when I found something that fixed the issue for me. There was a case where I was re-exporting a default from a package that didn't have a default. Removing that fixed all my auto-import issues. I actually still see stack traces in the exthost log, but import suggestions and auto-import have resumed working for me. eg. A simple module with no default export.
Because I don't want to
|
Thanks for the repro @willgittoes - I've been able to confirm that this was definitely the issue and that it's fixed on master My repro repo is https://github.com/orta/31465 - and if you use TS 3.5 and go to On top of that we now give errors for the |
Interesting, so running that on previous versions of typescript you could write: export * from './testutils'
export { default } from './testutils' When it wasn't possible, but you can't at all now |
This was re-opened by accident |
Uh oh!
There was an error while loading. Please reload this page.
TypeScript Version:
3.5-rc
(but existed for as long as 3.0 at least)Search Terms:
TypeScript autocomplete crashes import, Debug Failure. at Object.assertDefined getDefaultExportInfoWorker
Code
Irrelevant
Expected behavior:
Actual behavior:
TypeScript server emits an error whenever I try to import. This happens project-wide and when I open a new project under the same directory (i.e. same node_modules), autocomplete works as long as there are no imports at all in this new subproject. Any import to any package from node_modules seems to trigger it (i.e.
import React from 'react';
) but not imports to relative files in the project, (i.e.import { foo } from './bar';
).This is the stacktrace I get:
Related Issues:
This appears to be a repeating thing: #27857 #27878 #28149
The text was updated successfully, but these errors were encountered: