Skip to content

Type declarations archive gets written to a doubly-nested dist/dist/ folder inside the build output #4908

Description

@joeljoeljoel

Describe the bug

When a producer does not configure an explicit output.path in its webpack config, the type declarations archive (@mf-types.zip) and API file (@mf-types.d.ts) get written to a doubly-nested dist/dist/ folder inside the build output, instead of directly under the configured output directory (e.g. dist/@mf-types.zip).

This is made worse because mf-manifest.json's metaData.types.path field is always an empty string, regardless of this nesting — the manifest gives no indication that an extra dist subfolder needs to be prepended to locate the zip. As a consumer, resolving @mf-types.zip using the manifest's own types.path + types.zip fields leads to the wrong location and the type archive cannot be found, even though the manifest correctly names the file itself.

Expected behavior

The type declarations archive should be emitted at a single, predictable location under the compiler's output directory regardless of whether output.path is explicitly configured, and metaData.types.path should reflect that actual relative location so consumers can reliably resolve @mf-types.zip.

Workaround

With an explicit output.path set, the zip is emitted directly at the output root and this nesting doesn't occur — but nothing in the manifest signals when the extra directory is present versus not, since types.path is blank either way.

Reproduction

https://github.com/joeljoeljoel/webpack-mf-example

Used Package Manager

npm

System Info

System:
    OS: macOS 26.5.1
    CPU: (8) arm64 Apple M1
    Memory: 97.39 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.7.0 - /opt/homebrew/bin/node
    npm: 11.5.1 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 145.0.7632.76
    Safari: 26.5

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions