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

Wrong import suggestion in subpath pattern #52870

Open
konsalex opened this issue Feb 16, 2023 · 6 comments
Open

Wrong import suggestion in subpath pattern #52870

konsalex opened this issue Feb 16, 2023 · 6 comments
Labels
Needs Investigation This issue needs a team member to investigate its status.
Milestone

Comments

@konsalex
Copy link

konsalex commented Feb 16, 2023

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.75.1
  • OS Version: Darwin x64 22.1.0 (MacOS)

Steps to Reproduce:

  1. Install @neo4j-ndl/react@1.0.0-alpha-fafbc08
  2. Try to import an icon like <AdjustmentsHorizontalIconSolid /> in a JSX file.

The recommended import path is @neo4j-ndl/react/lib/types/icons while the correct based on the exports field would be @neo4j-ndl/react/icons

The modified package.json is looking like this:

{
  "name": "@neo4j-ndl/react",
  "version": "0.17.7",
  "sideEffects": false,
  "description": "React implementation of Neo4j Design System",
  "keywords": [
    "neo4j",
    "react",
    "design system",
    "needle",
    "ndl"
  ],
  "author": "Neo4j Inc.",
  "homepage": "",
  "license": "GPL-3.0",
  "main": "./lib/cjs/index.js",
  "module": "./lib/esm/index.js",
  "types": "./lib/types/index.d.ts",
  "exports": {
    "./icons": {
      "import": "./lib/esm/icons/index.js",
      "require": "./lib/cjs/icons/index.js",
      "types": "./lib/types/icons/index.d.ts"
    },
    ".": {
      "import": "./lib/esm/index.js",
      "require": "./lib/cjs/index.js",
      "types": "./lib/types/index.d.ts"
    }
  },
 ...
}

As a library publishers tried it also with WebStorm to see how it behaves and I can see that there it is imported as expected (video):

CleanShot.2023-02-16.at.17.48.07.mp4

Also noticed, that if there is one module imported from @neo4j-ndl/react/icons then the suggestion works as expected (image):
CleanShot 2023-02-16 at 18 00 20@2x

@mjbvz mjbvz transferred this issue from microsoft/vscode Feb 20, 2023
@mjbvz mjbvz removed their assignment Feb 20, 2023
@mjbvz
Copy link
Contributor

mjbvz commented Feb 20, 2023

Can you please try upgrading your workspace to use the next version of typescript by installing this extension and then restarting VS Code. Does this fix the issue?

@konsalex
Copy link
Author

@mjbvz no unfortunately, still the same:

CleanShot 2023-02-20 at 17 11 51@2x

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Feb 24, 2023
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Feb 24, 2023
@RyanCavanaugh
Copy link
Member

A reduced repro would let us look at this earlier

@mbrevda
Copy link

mbrevda commented Feb 14, 2024

Look like this was fixed in #55015

@konsalex
Copy link
Author

@mbrevda tried with TS 5.4, and still have the same issue in VS Code.

Example screenshot:

CleanShot 2024-02-14 at 15 26 40@2x

Here you can find the package config:
https://www.jsdelivr.com/package/npm/@neo4j-ndl/react?tab=files

Not sure what is different from WebStorm's approach, but there is works as expected:
CleanShot 2024-02-14 at 15 28 49@2x

@mbrevda
Copy link

mbrevda commented Feb 14, 2024

Realizing now that our use cases differ: I'm doing subpath imports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
Development

No branches or pull requests

4 participants