Skip to content

package.json#imports doesn't get IDE suggestions when typing the import path directly #57680

Closed
@anthonyshew

Description

@anthonyshew

🔎 Search Terms

package.json imports, package.json imports intellisense, package.json imports autocomplete, package.json import suggestions

🕗 Version & Regression Information

This feature released with v5.4 yesterday so not too much bisection to be done. 😄

⏯ Playground Link

https://github.com/anthonyshew/packagejson-imports-typescript-suggestions

💻 Code

I apologize for not following the standards of the template to provide a TypeScript playground. I couldn't find a way to work with imports or a package.json there. If that is possible and I missed it, please let me know so I can update appropriately.

Reproduction repository: https://github.com/anthonyshew/packagejson-imports-typescript-suggestions

package.json#import: https://github.com/anthonyshew/packagejson-imports-typescript-suggestions/blob/b33225588c9ca061807f8c1cb55c50dff66ef581/package.json#L6

Attempted inference: https://github.com/anthonyshew/packagejson-imports-typescript-suggestions/blob/b33225588c9ca061807f8c1cb55c50dff66ef581/app/page.tsx#L1

🙁 Actual behavior

With your cursor on the path string for the import on line 1 of ./app/page.tsx, opening suggestions does not provide autocomplete.
CleanShot 2024-03-07 at 11 39 38@2x

🙂 Expected behavior

I was hoping to see a suggestion for #components/TestComponent.tsx. Notably, if I write it out fully myself, my editor is happy and my build compiles/bundles successfully so I'm relatively certain that I am set up correctly.

Additional information about the issue

I did some light futzing with the "allowImportingTsExtensions" and "verbatimModuleSyntax" compiler options in my tsconfig.json and was noticing some un-aligned behavior. I'm not sure if this is deserving of another bug report or is related.

As an example, auto-importing seems to use verbatimModuleSyntax (or something like it) even when I don't have that flag enabled. Again, not certain if related.
CleanShot 2024-03-07 at 11 43 15@2x

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions