fix(typescript): make the built package loadable as ESM - #30
Merged
Conversation
The published package could not be imported by Node: ERR_UNSUPPORTED_DIR_IMPORT: Directory import '.../dist/generated/client' is not supported resolving ES modules The generated sources import with extensionless, sometimes directory-shaped specifiers -- `export * from './generated/client'`. TypeScript's `bundler` module resolution accepts those and emits them unchanged, which is correct for a bundler and invalid for Node. Vite resolved it happily; vitest in ESA-Blueshell/website did not, and 39 of its test files failed to import. The emitted output is now rewritten after compilation: `./x` becomes `./x.js`, or `./x/index.js` where the target is a directory. 47 specifiers per package. The reason this shipped is worth recording: every test here ran against the TypeScript sources, and nothing ever imported the build. CI now loads dist/index.js the way Node does and asserts the sdk came with it. Verified failing against an unfixed build before being committed.
Merged
github-actions Bot
added a commit
that referenced
this pull request
Sep 2, 2026
🤖 I have created a release *beep* *boop* --- <details><summary>1.0.2</summary> ## [1.0.2](v1.0.1...v1.0.2) (2026-09-02) ### Bug Fixes * **typescript:** make the built package loadable as ESM ([#30](#30)) ([93f05aa](93f05aa)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
The published package cannot be imported by Node:
The generated sources import with extensionless, sometimes directory-shaped specifiers —
export * from './generated/client'. TypeScript'sbundlerresolution accepts those and emits them unchanged: correct for a bundler, invalid for Node. Vite resolved it happily; vitest inESA-Blueshell/websitedid not, and 39 test files failed to import.The emitted output is now rewritten after compilation —
./x→./x.js, or./x/index.jsfor a directory. 47 specifiers per package.Why it shipped
Every test in this repository ran against the TypeScript sources; nothing ever imported the build. CI now loads
dist/index.jsthe way Node does and asserts the sdk came with it. Verified failing against an unfixed build before being committed.