developit / developit/microbundle

Bundled type definitions for bundled dependencies?

未关闭
#1,050 5 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
TypeScript
主要语言
JavaScript
星标
8.1k
派生
358
PR 合并指标
30 天内没有已合并 PR

描述

**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

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。