microsoft / microsoft/TypeScript
Wrong import suggestion in subpath pattern
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.4k
- Merge trung bình
- 1 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 117
Mô tả
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:
- Install
@neo4j-ndl/react@1.0.0-alpha-fafbc08 - 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):
Also noticed, that if there is one module imported from @neo4j-ndl/react/icons then the suggestion works as expected (image):

Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Tái hiện vấn đề trong một tệp JSX bằng cách sử dụng package.json đã sửa đổi và trường exports của nó, bắt đầu với ví dụ về package @neo4j-ndl/react/icons. Theo dõi hành vi đề xuất import đối với một mẫu subpath của package và so sánh với trường hợp hoạt động sau khi import từ @neo4j-ndl/react/icons. Hoàn tất khi đường dẫn được đề xuất là @neo4j-ndl/react/icons thay vì @neo4j-ndl/react/lib/types/icons.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, typescript
- Lĩnh vực
- developer-experience, tooling
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100