Repository navigation
fix(sdk-playground): the Vite config loads on Node 22 before 22.18 - #7805
Open
wonjangcloud9 wants to merge 1 commit into
Open
wonjangcloud9 wants to merge 1 commit into
wonjangcloud9 wants to merge 1 commit into
Conversation
vite.config.ts imported createFsAdapter from @hyperframes/sdk/adapters/fs. Vite leaves a bare import in a config file to Node, and that export points at src/adapters/fs.ts, so Node had to load a .ts file itself. Node only does that without a flag from 22.18, and on 22.0 to 22.17 build, dev and test all stopped with ERR_UNKNOWN_FILE_EXTENSION, which also failed the last step of the root build. The config now imports the adapter by its relative source path, which Vite bundles with the config on every Node version. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch has not been deployed
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.
What
packages/sdk-playground's Vite config now loads on every Node 22 release, sobun run buildat the repo root finishes on Node 22.0 to 22.17 too.Why
The README asks for "Node.js 22+" and the packages declare
"node": ">=22". On Node 22.16 the root build runs every package and then fails at its last step:bun run devandbun run testinpackages/sdk-playgroundstop with the same error, since both load the same config.vite.config.tsimportscreateFsAdapterfrom@hyperframes/sdk/adapters/fs. When Vite bundles a config file it leaves bare package imports to Node, and that export'simportcondition is./src/adapters/fs.ts. Node loads a.tsfile without a flag only from 22.18 (type stripping), which is why CI (node-version: 22, currently a later 22.x) does not see it.Related work
No open or closed issue or PR covers this. I searched "sdk-playground build", "Node 22.18", "type stripping" and "ERR_UNKNOWN_FILE_EXTENSION". #1298 (closed) was a similar symptom in Studio's Vite build from an earlier layout.
How
One line in
packages/sdk-playground/vite.config.ts: the adapter is imported by its relative source path (../sdk/src/adapters/fs). Vite bundles relative imports into the config with esbuild, so Node never sees the.tsfile. The adapter's own bare import,@hyperframes/core/atomic-file, already has anodecondition pointing atdist. The type-only import of@hyperframes/sdkis erased and stays as it is.I considered
--configLoader runneron the three scripts instead; it also works, but it is three flags (and an experimental loader) where one import does it.Test plan
All on Node 22.16.0, macOS, main
04ee926d.Before, in
packages/sdk-playground:bun run build,bun run testandvite(dev) each fail with theERR_UNKNOWN_FILE_EXTENSIONabove.After:
bun run build→✓ built in 915msbun run test→ 3 files, 5 tests passedbun run typecheck→ cleanvite --port 5199→ dev server is upbun run build→ every step exits 0, including@hyperframes/sdk-playground buildnode scripts/check-workspace-contracts.mjsare cleanI did not add a test: on Node 22.18 and later (what CI runs) the old import loads too, so a test there would pass with or without the change. I have no newer Node on this machine, so the 22.18+ side is covered by CI on this PR.
🤖 Generated with Claude Code