Skip to content

Bundled type definitions for bundled dependencies? #1050

@donmccurdy

Description

@donmccurdy

Context: As documented in #454 and How Microbundle decides which dependencies to bundle, 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 about such requests.

Related:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions