Skip to content

Conversation

@wcole1-godaddy
Copy link

Problem

The ESM build at dist/esm/index.js exports without .js extensions:

export * from './src/extensions';
export * from './src/spec_generated';

This causes Node.js ESM resolution to fail with errors like:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module './src/extensions'

Solution

Add explicit .js extensions to all ESM import/export paths. TypeScript preserves these extensions in the compiled output, allowing Node.js ESM to resolve modules correctly.

Changes

  • index.ts: Added .js extension to exports
  • src/extensions.ts: Added .js extension to spec_generated import

Testing

After this fix, ESM imports work correctly:

node --input-type=module -e "import * as sdk from './dist/esm/index.js'; console.log(Object.keys(sdk).length);"

TypeScript's ESM output omits file extensions by default, but Node.js ESM
requires explicit .js extensions in import/export paths. This caused errors
like 'Cannot find module ./src/extensions' when consuming the package in
ESM environments.

Files changed:
- index.ts: Added .js extension to exports
- src/extensions.ts: Added .js extension to spec_generated import
@wcole1-godaddy wcole1-godaddy requested a review from a team January 17, 2026 17:08
@google-cla
Copy link

google-cla bot commented Jan 17, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

1 participant