Skip to content

fix(typescript-sdk): add subpath export for v1 to support ESM imports#3650

Open
dhimanAbhi wants to merge 1 commit intohatchet-dev:mainfrom
dhimanAbhi:fix/typescript-sdk-esm-v1-import
Open

fix(typescript-sdk): add subpath export for v1 to support ESM imports#3650
dhimanAbhi wants to merge 1 commit intohatchet-dev:mainfrom
dhimanAbhi:fix/typescript-sdk-esm-v1-import

Conversation

@dhimanAbhi
Copy link
Copy Markdown

Description

Fixes ESM import error when using: import { HatchetClient } from '@hatchet-dev/typescript-sdk/v1';

In native Node.js ESM environments, this import currently throws: ERR_UNSUPPORTED_DIR_IMPORT

This happens because Node.js ESM does not support directory imports without explicit subpath exports. This PR adds a proper subpath export for ./v1, mapping it to dist/v1/index.js, allowing the documented import path to work correctly in ESM.

Fixes #3613

Type of change

  • Bug fix (non-breaking change which fixes an issue)

What's Changed

  • Added subpath export for ./v1 in package.json
  • Ensured compatibility with both ESM (import) and CommonJS (require)
  • Verified fix using a minimal ESM reproduction setup

Signed-off-by: Abhishek Dhiman <abhi2002dhiman@gmail.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 20, 2026

@dhimanAbhi is attempting to deploy a commit to the Hatchet Team on Vercel.

A member of the Team first needs to authorize it.

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.

[BUG] Typescript SDK: ESM import error for native ESM

1 participant