fix: correct exports map to match actual build output#3
Merged
Conversation
The exports/main/module fields pointed at dist/index.mjs, which tsup never produces. With "type": "module" set, tsup emits the ESM build as index.js and the CJS build as index.cjs. Node resolved `import` to the non-existent index.mjs and threw "Cannot find module". Align main/module/exports with the real output, and route CJS consumers to index.d.cts instead of the ESM index.d.ts. Fixes #2
Unit and integration tests run against src/ via TypeScript and never load dist/ or resolve the package.json exports map, so a broken exports map (issue #2) passes every other check. Add scripts/smoke-test.mjs, which packs the tarball, installs it into a throwaway directory, and loads it by package name through both import and require. Wired into CI after the test step and exposed as the test:smoke npm script.
Member
Author
|
Added a package smoke test ( It packs the tarball, installs it into a throwaway directory, and loads |
This was referenced May 20, 2026
asachs01
added a commit
that referenced
this pull request
May 20, 2026
…#6) Salvages the still-relevant pieces of the abandoned fix/review-medium branch (its exports-map fix and smoke test already landed via #3/#5): - Regenerate package-lock.json via `npm audit fix`, clearing 16 of 19 dev-dependency advisories (incl. the critical/high vite findings). The remaining 3 live inside npm's own bundled deps under semantic-release and are not resolvable from here. - tsup `target` node18 -> node22, matching `engines.node` (>=22). - config.test.ts: replace `as any` with `as unknown as SuperOpsRegion`. No production dependencies were affected; the published package is unchanged at runtime.
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.
Problem
Closes #2. Installing the package and
import-ing it failed withCannot find module .../dist/index.mjs.Root cause: a mismatch between
package.jsonand whattsupactually builds.import→dist/index.mjsrequire→dist/index.jsmain→dist/index.jsmodule→dist/index.mjsBecause
package.jsonhas"type": "module", tsup names the ESM outputindex.jsand the CJS outputindex.cjs— it never emits.mjs. Theexportsmap was written for the opposite (no-"type": "module") convention.Fix
Align
main/module/exportswith the realdist/output:import→./dist/index.js(ESM)require→./dist/index.cjs(CJS)./dist/index.d.ctstypes instead of the ESM./dist/index.d.tsVerification
Built locally; both entry points resolve:
import('./dist/index.js')→ exports resolve ✅require('./dist/index.cjs')→ exports resolve ✅semantic-release will cut a
1.0.4patch and updateCHANGELOG.mdon merge.