Skip to content

fix: Publish a CommonJS entrypoint - #6

Closed
razor-x wants to merge 1 commit into
mainfrom
claude/url-param-parser-migration-i9foa1
Closed

fix: Publish a CommonJS entrypoint#6
razor-x wants to merge 1 commit into
mainfrom
claude/url-param-parser-migration-i9foa1

Conversation

@razor-x

@razor-x razor-x commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

The 0.2.1 release (after the template update) publishes ESM-only — the package exports only an import condition:

".": { "import": { "types": "./index.d.ts", "default": "./index.js" } }

CommonJS consumers fail with Error: No "exports" main defined in .../@seamapi/url-search-params-parser/package.json. This blocks seamapi/nextlove#182, which consumes this package from nextlove's CJS build and its CJS-transformed test runner.

Changes

Restores the dual-format build this repo had before the template update, matching @seamapi/url-search-params-serializer's packaging exactly:

  • tsup.config.ts builds dist/index.cjs + dist/index.d.cts (+ sourcemap) from src/index.ts, run via postbuild:entrypoints. The dts build passes ignoreDeprecations: '6.0' because the tsconfig's baseUrl (used for path aliases) is reported as an error under TypeScript 6.
  • exports["."].require./dist/index.cjs with ./dist/index.d.cts types.
  • dist added to published files; tsup added to devDependencies.

Verification

  • require('@seamapi/url-search-params-parser') works from Node 22 and parses correctly (strict mode: foo=a,b&bar=2{"foo":["a,b"],"bar":2}).
  • ESM import unchanged.
  • npm test (73 tests) and npm run lint pass.

Releases as 0.2.2.


Generated by Claude Code

Restore the dual-format build dropped in the template update: tsup
builds dist/index.cjs and dist/index.d.cts from the same entrypoint,
and the package exports a require condition matching
@seamapi/url-search-params-serializer. Without it, CommonJS consumers
such as nextlove fail with ERR_PACKAGE_PATH_NOT_EXPORTED.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015jWzL9LC7Q6bTGaXDoKq4z

razor-x commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

Closing: no longer needed. nextlove is dropping its CommonJS build and consuming this package as ESM directly (see seamapi/nextlove#182), so the parser can stay ESM-only as the template intends.


Generated by Claude Code

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.

2 participants