Missing dependency on preact / react (ghost dependency)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, react
- Lĩnh vực
- build-system, frontend
Hướng nghiên cứu
Kiểm tra các khai báo dependency trong package.json và các đường dẫn import của preact và react được mô tả trong báo cáo. Tái hiện lỗi với Yarn Plug'n'Play, sau đó so sánh các tùy chọn dependency trong issue. Hoàn thành khi package khai báo chính xác các yêu cầu runtime và không xảy ra lỗi ghost-dependency với bất kỳ thư viện nào trong hai thư viện được hỗ trợ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
This module tries to import / require from preact, but does not declare it as a dependency in its package.json (a ghost dependency). This is an error, yarn requires all dependency to be listed properly:
Module not found: Error: Can't resolve 'preact' in 'C:\Users\user\AppData\Local\Yarn\Berry\cache\htm-npm-3.1.1-e3b831f850-10.zip\node_modules\htm\preact'
resolve 'preact' in 'C:\Users\user\AppData\Local\Yarn\Berry\cache\htm-npm-3.1.1-e3b831f850-10.zip\node_modules\htm\preact'
Parsed request is a module
using description file: C:\Users\user\AppData\Local\Yarn\Berry\cache\htm-npm-3.1.1-e3b831f850-10.zip\node_modules\htm\preact\package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
request is not managed by the pnpapi
htm tried to access preact, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: preact
Required by: htm@npm:3.1.1 (via C:\Users\user\AppData\Local\Yarn\Berry\cache\htm-npm-3.1.1-e3b831f850-10.zip\node_modules\htm\preact\)
@ ../../../../../../AppData/Local/Yarn/Berry/cache/@bpmn-io-diagram-js-ui-npm-0.2.3-01795dd8e0-10.zip/node_modules/@bpmn-io/diagram-js-ui/lib/index.js 1:0-34 1:0-34
@ ../../../../../../AppData/Local/Yarn/Berry/cache/diagram-js-npm-15.2.4-de7db86f90-10.zip/node_modules/diagram-js/lib/ui/index.js 1:0-39 1:0-39
@ ../../../../../../AppData/Local/Yarn/Berry/cache/diagram-js-npm-15.2.4-de7db86f90-10.zip/node_modules/diagram-js/lib/features/popup-menu/PopupMenu.js 1:0-4:18 132:2-8 133:4-8 278:2-8
@ ../../../../../../AppData/Local/Yarn/Berry/cache/diagram-js-npm-15.2.4-de7db86f90-10.zip/node_modules/diagram-js/lib/features/popup-menu/index.js 1:0-36 12:23-32
@ ../../../../../../AppData/Local/Yarn/Berry/cache/bpmn-js-npm-18.2.0-5474b88486-10.zip/node_modules/bpmn-js/lib/features/align-elements/index.js 3:0-65 13:4-19
@ ../../../../../../AppData/Local/Yarn/Berry/cache/bpmn-js-npm-18.2.0-5474b88486-10.zip/node_modules/bpmn-js/lib/Modeler.js 12:0-60 167:2-21
@ ./src/bpmn-editor/render-bpmn-editor.ts 7:0-48 33:31-41
@ ./src/bpmn-editor/index.ts 1:0-40 1:0-40
The same goes for react. Possible ways how the dependencies could be fixed:
- declare both react and preact as dependencies (will always install both preact and react)
- declare both react and preact as optional peer dependencies (preferred)
(will force users to install both react and preact) create 2 separate NPM packages, so that each package can declare its dependencies properly
Workaround
For people affected: You can add the following bandage aid to fix the declared dependencies (file .yarnrc.yml):
packageExtensions:
htm@*:
peerDependencies:
preact: "*"
react: "*"
peerDependenciesMeta:
preact:
optional: true
react:
optional: true
- Ngôn ngữ chính
- JavaScript
- Star
- 9k
- Fork
- 181
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
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.
Issue khác của developit/htm
-
Sarthak Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 1/100
-
Tugas Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
-
Tugas Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 1/100
-
type checking templates Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
Can we say htm as internal dsl Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Tất cả issue của developit/htm
Issue tương tự
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Improve Title Support Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
georgestephanis/p2026#40 ·
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Margaret-Petersen/food-delivery-app-clone-react-native#1981 ·