Skip to content

[publint] publishConfig.exports is used for linting by warning message uses value from root's exports #883

Closed

Description

@timofei-iatsenko

Reproduction link or steps

With a given package.json file

  "exports": {
    ".": "./src/index.ts"
  },
  "publishConfig": {
    "exports": {
      ".": "./dist/index.mjs"
    }
  },

Imagine we don't have ./dist/index.mjs file on the disk, the publint correctly report an issue, but the warning message is using data from the normal exports

The repro is here https://github.com/timofei-iatsenko/tsdown-publint-issue-repro

What is expected?

Warning message uses message from publishConfig.exports

ERROR [publint] pkg.exports["."] is ./dist/index.mjs but the file does not exist.

What is actually happening?

The warning message is using data from the normal exports, not from the publishConfig.exports

ERROR [publint] pkg.exports["."] is ./src/index.ts but the file does not exist.

So actually ./src/index.ts exists, but /dist/index.mjs is not. The warning message makes it confusing

Any additional comments?

This happend only when publint invoked from the tsdown. When publint is used from it's own cli - reporting is correct.

Activity

  1. bluwy commented on Mar 31, 2026

    @bluwy

    I think this can be fixed by also getting the pkg here:

    const { messages } = await publint({
    ...options.publint,
    pack: { tarball: tarball.buffer },
    })

    And pass it to:

    const formattedMessage = formatMessage(message, options.pkg)

    The pkg would be from the tarball so it's more accurate. pkg is only returned since publint v0.3.8 though, so it would likely still need the options.pkg fallback.

  2. sxzz commented on Apr 26, 2026

    @sxzz
    Member

    The path in your reproduction is incorrect:

    Image

    After correct it, it works well.

    Image
  3. bluwy commented on Apr 26, 2026

    @bluwy

    It's supposed to be incorrect, because the issue is demonstrating that the publint error message displays the wrong path.

  4. reopened this on Apr 27, 2026
  5. sxzz commented on Apr 27, 2026

    @sxzz
    Member

    Sorry, I misunderstood the issue.

  6. added 2 commits that reference this issue on Apr 27, 2026
    5ec7598
    413bb46
  7. sxzz commented on Apr 27, 2026

    @sxzz
    Member

    Fixed in 0.22.0-beta.1

  8. locked and limited conversation to collaborators on May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions