Passing `BuildConfig[]` to `defineBuildConfig` fails on export validation if each `BuildConfig` iterative populates the `./dist` with the exported files. · Issue #356 · unjs/unbuild · GitHub
Skip to content

Passing BuildConfig[] to defineBuildConfig fails on export validation if each BuildConfig iterative populates the ./dist with the exported files. #356

Description

@joemckenney

Environment

Node v20.10.0

Package(s) The family of tools in https://github.com/pkg-tools/pkg-tools e.g.

https://www.npmjs.com/package/@pkg-tools/build
https://www.npmjs.com/package/@pkg-tools/clean
https://www.npmjs.com/package/@pkg-tools/format
https://www.npmjs.com/package/@pkg-tools/lint
https://www.npmjs.com/package/@pkg-tools/sync

Reproduction

The easiest explanation/reproduction is this pull request.

I had to add failOrWarn: false to all of the CLI package's build configurations due to them iteratively generating the outputs that satisfy the package.json's exports field.

Describe the bug

When passing a set of build configurations (i.e., BuildConfig[]) whose outputs will cumulatively satisfy the exports specified in the package.json's exports field, unbuild will fail on validation after the first output due to the package.json's exports not existing in the output directory.

Additional context

I'm more than happy to contribute a fix.

Logs

No response

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