developit / developit/microbundle

Bundled type definitions for bundled dependencies?

Đang mở
#1,050 5 bình luận 1 reaction 0 người được giao Xem trên GitHub
TypeScript
Ngôn ngữ chính
JavaScript
Star
8.1k
Fork
358
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

**Context:** As documented in #454 and [*How Microbundle decides which dependencies to bundle*](https://github.com/developit/microbundle/wiki/How-Microbundle-decides-which-dependencies-to-bundle#1-i-want-to-bundle-a-dependency), one recommended way to bundle dependencies is to put the dependency in `devDependencies` rather than `dependencies`.

**Problem:** `my-bundled-dependency` is bundled into `my-parent-library`, and affects its exported type definitions. Recently a downstream user of my package reported an issue that surprised me – while the JavaScript is bundled as expected, the type definitions are not bundled, and contain an import from `my-bundled-dependency`. This causes builds to fail for users of `my-parent-library` if they've enabled TypeScript's `skipLibCheck: false`. If this is unexpected and a simple repro example would be helpful, I'm happy to create that.

**Alternatives:** Should the type definitions also be bundled by Microbundle? By TypeScript? Am I perhaps making a mistake by using a bundled dependency in my exported TypeScript API? I'm inclined to the idea that this is something TypeScript, not Microbundle, should ideally handle. But they've historically been pretty [unenthusiastic](https://github.com/microsoft/TypeScript/issues/4433) about such requests.

**Related:**

- https://github.com/donmccurdy/glTF-Transform/issues/996

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Start with the context in #454 and the linked Microbundle dependency-bundling guidance. Reproduce the case where a JavaScript dependency is bundled but its exported type definitions still import that dependency, using TypeScript with skipLibCheck set to false. Done means the project has a decided scope for handling bundled dependency types and a verified reproduction or test.

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
build-system, tooling
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.