Skip to content

fix: pin dist output extensions so published packages resolve#19

Merged
amondnet merged 3 commits into
mainfrom
fix/dist-output-extension-mismatch
Jun 1, 2026
Merged

fix: pin dist output extensions so published packages resolve#19
amondnet merged 3 commits into
mainfrom
fix/dist-output-extension-mismatch

Conversation

@amondnet
Copy link
Copy Markdown
Contributor

@amondnet amondnet commented Jun 1, 2026

Summary

The published @pleaseai/eslint-config@0.0.3 is broken: its tarball ships
dist/index.js + dist/index.d.ts, but package.json main/exports/types
point to ./dist/index.mjs / ./dist/index.d.mts. Any consumer fails with:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in
.../@pleaseai/eslint-config/package.json

…so ESLint can't even load a flat config that imports it.

Verified directly against npm:

$ npm view @pleaseai/eslint-config@0.0.3 — tarball contains:
  package/dist/index.js          # but package.json points to ./dist/index.mjs
  package/dist/index.d.ts        # but package.json points to ./dist/index.d.mts

@pleaseai/code-style (cli) has the same latent hazard.

Root cause

tsdown's default ESM output extension for a "type": "module" package
varies by version
— it emitted .js up to ~0.21.5 (when 0.0.3 was built) and
.mjs from ~0.21.7 onward — while package.json hard-codes .mjs. A tsdown
bump silently drifts the build output away from the exports map, shipping a
package whose entry points 404.

Fix

Pin outExtensions in both tsdown configs so the emitted files always match the
declared .mjs / .d.mts entry points, independent of the tsdown version:

outExtensions: () => ({ js: '.mjs', dts: '.d.mts' }),

Verification

  • bun run build → both packages now emit dist/*.mjs + dist/*.d.mts,
    matching their package.json exports.
  • Resolution smoke test now passes (previously ERR_PACKAGE_PATH_NOT_EXPORTED):
    node -e "import('@pleaseai/eslint-config')"            # default: function
    node -e "import('@pleaseai/eslint-config/package-json')" # subpath resolves
    
  • eslint clean on both changed configs.

Both packages will get a patch release via release-please, producing a working
@pleaseai/eslint-config@0.0.4.

Note (unrelated)

CI lint currently fails on two pre-existing style/no-multi-spaces errors
in docs/adr/0002-workaround-docus-i18n-routing-bug.md (present on main,
untouched here). Left out to keep this PR focused on the packaging fix — happy
to fix separately.

amondnet added 2 commits June 1, 2026 20:52
…exports

The published 0.0.3 tarball shipped `dist/index.js` + `dist/index.d.ts`, but
package.json `main`/`exports`/`types` point to `./dist/index.mjs` and
`./dist/index.d.mts`. Consumers therefore fail to load the package with
`ERR_PACKAGE_PATH_NOT_EXPORTED` (and ESLint can't load a flat config that
imports it).

Root cause: tsdown's default ESM output extension for a `"type": "module"`
package changed across versions — it emitted `.js` up to ~0.21.5 (when 0.0.3
was built) and `.mjs` afterwards — while package.json hard-codes `.mjs`. The
build output silently drifted away from the `exports` map.

Pin `outExtensions` to `.mjs` / `.d.mts` so the emitted files always match
the declared entry points regardless of the tsdown version.
`@pleaseai/code-style` has the same latent packaging hazard as
`@pleaseai/eslint-config`: package.json `main`/`exports` point to `.mjs` /
`.d.mts` while tsdown's default ESM extension for a `"type": "module"` package
varies by version. Pin `outExtensions` to `.mjs` / `.d.mts` so the build can
never drift from the declared entry points.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the tsdown.config.ts files in both packages/cli and packages/eslint-config to explicitly pin the output extensions to .mjs and .d.mts. This ensures that the generated build artifacts consistently match the paths declared in the exports field of package.json, preventing potential package resolution errors due to varying default extensions in different versions of tsdown. There are no review comments, and I have no additional feedback to provide.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Jun 1, 2026

Deploying code-style with  Cloudflare Pages  Cloudflare Pages

Latest commit: af0bdb3
Status: ✅  Deploy successful!
Preview URL: https://b6b65ee9.code-style.pages.dev
Branch Preview URL: https://fix-dist-output-extension-mi.code-style.pages.dev

View logs

@amondnet amondnet self-assigned this Jun 1, 2026
Fixes the pre-existing style/no-multi-spaces lint errors that fail CI.
@amondnet amondnet merged commit 116a92b into main Jun 1, 2026
2 checks passed
@pleaseai-bot pleaseai-bot Bot mentioned this pull request Jun 1, 2026
@amondnet amondnet deleted the fix/dist-output-extension-mismatch branch June 1, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant