Skip to content

fix(studio): use tsx/esm loader for vite build to resolve .ts imports#1298

Open
zubaier-create wants to merge 1 commit into
heygen-com:mainfrom
zubaier-create:fix/studio-build-ts-extension
Open

fix(studio): use tsx/esm loader for vite build to resolve .ts imports#1298
zubaier-create wants to merge 1 commit into
heygen-com:mainfrom
zubaier-create:fix/studio-build-ts-extension

Conversation

@zubaier-create

Copy link
Copy Markdown

What changed

packages/studio/package.json build script changed from:

vite build

to:

node --import tsx/esm node_modules/.bin/vite build

Why

When Vite loads vite.config.ts, it imports workspace packages via their exports map. In development mode, @hyperframes/core maps subpath exports (e.g. ./fonts/aliases) directly to .ts source files. Node's native ESM loader rejects .ts extensions, throwing:

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts"
for /packages/core/src/fonts/aliases.ts

Prefixing the build command with node --import tsx/esm registers the tsx loader before Vite starts, so Node can resolve and transpile TypeScript source exports during config load. This unblocks the studio build and, downstream, the CLI build which bundles the studio dist/.

Testing

bun run --filter @hyperframes/studio build  # now exits 0
bun run --filter @hyperframes/cli build     # now exits 0

Node's native ESM loader rejects `.ts` file extensions when Vite loads
the config, which causes `@hyperframes/core/fonts/aliases` to fail with
ERR_UNKNOWN_FILE_EXTENSION. Prefixing vite build with
`node --import tsx/esm` lets Node resolve TypeScript source exports
during the build, unblocking `packages/studio` and the downstream CLI
build that bundles the studio dist.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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