Skip to content

Migrate module resolution to NodeNext#3

Closed
inakineitor wants to merge 10 commits intoanomalyco:mainfrom
inakineitor:claude/update-module-resolution-nodenext-MUlyx
Closed

Migrate module resolution to NodeNext#3
inakineitor wants to merge 10 commits intoanomalyco:mainfrom
inakineitor:claude/update-module-resolution-nodenext-MUlyx

Conversation

@inakineitor
Copy link
Contributor

@inakineitor inakineitor commented Mar 20, 2026

This packages simplifies the build process by setting up the modern version of the package.json export fields. @kommander I tried to replicate the current functionality since it looks like you probably use it directly from source while debugging. The new build should support that out of the box plus build correctly for NodeNext when publishing.

Key Changes

  • Switch tsconfig.json from bundler to NodeNext module resolution, requiring explicit .js extensions on all relative imports
  • Add proper exports map with bun, source, types, and import conditions
  • Point main/module/types fields to dist/ output instead of raw source
  • Add files field (dist, src) to publish from repo root, eliminating the build script's copy-and-rewrite step
  • Simplify build.sh to just build + type generation

https://claude.ai/code/session_01Sei5cqkt33RLgNbWcKvsrw

claude added 7 commits March 20, 2026 09:34
- Change moduleResolution and module to NodeNext in tsconfig.json
- Remove allowImportingTsExtensions (incompatible with NodeNext)
- Add explicit "types": ["bun"] for proper type resolution
- Update all relative imports to use .js extensions across src, tests,
  examples, and bench files

https://claude.ai/code/session_01Sei5cqkt33RLgNbWcKvsrw
Adds "exports" field with types and import conditions for proper
NodeNext resolution by downstream consumers. Updates build script
to rewrite dist paths accordingly.

https://claude.ai/code/session_01Sei5cqkt33RLgNbWcKvsrw
Lets Bun resolve directly to the TypeScript source, skipping
the compiled dist output for faster dev and native TS support.

https://claude.ai/code/session_01Sei5cqkt33RLgNbWcKvsrw
Points to the TypeScript source for tools and bundlers that
support the source condition for development builds.

https://claude.ai/code/session_01Sei5cqkt33RLgNbWcKvsrw
These legacy fields now match the exports map, pointing to the
built dist output instead of src. Simplifies the build script
sed rewrites to just strip the dist/ and src/ prefixes.

https://claude.ai/code/session_01Sei5cqkt33RLgNbWcKvsrw
Add "files" field to whitelist dist/ and src/ for publishing,
removing the need to copy and rewrite package.json into dist/.

https://claude.ai/code/session_01Sei5cqkt33RLgNbWcKvsrw
@inakineitor inakineitor changed the title Migrate to NodeNext module resolution with explicit .js extensions Migrate module resolution to NodeNext Mar 20, 2026
@inakineitor inakineitor marked this pull request as ready for review March 20, 2026 19:40
@simonklee simonklee closed this Mar 24, 2026
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.

3 participants