fix: pin dist output extensions so published packages resolve#19
Merged
Conversation
…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.
There was a problem hiding this comment.
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.
Deploying code-style with
|
| 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 |
Fixes the pre-existing style/no-multi-spaces lint errors that fail CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The published
@pleaseai/eslint-config@0.0.3is broken: its tarball shipsdist/index.js+dist/index.d.ts, butpackage.jsonmain/exports/typespoint to
./dist/index.mjs/./dist/index.d.mts. Any consumer fails with:…so ESLint can't even load a flat config that imports it.
Verified directly against npm:
@pleaseai/code-style(cli) has the same latent hazard.Root cause
tsdown's default ESM output extension for a
"type": "module"packagevaries by version — it emitted
.jsup to ~0.21.5 (when 0.0.3 was built) and.mjsfrom ~0.21.7 onward — whilepackage.jsonhard-codes.mjs. A tsdownbump silently drifts the build output away from the
exportsmap, shipping apackage whose entry points 404.
Fix
Pin
outExtensionsin both tsdown configs so the emitted files always match thedeclared
.mjs/.d.mtsentry points, independent of the tsdown version:Verification
bun run build→ both packages now emitdist/*.mjs+dist/*.d.mts,matching their
package.jsonexports.ERR_PACKAGE_PATH_NOT_EXPORTED):eslintclean 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
lintcurrently fails on two pre-existingstyle/no-multi-spaceserrorsin
docs/adr/0002-workaround-docus-i18n-routing-bug.md(present onmain,untouched here). Left out to keep this PR focused on the packaging fix — happy
to fix separately.