fix(middleware): native Node ESM imports (.js extensions) — @threadplane/middleware 0.0.2#675
Merged
Merged
Conversation
…ESM) + bump 0.0.2 The emitted ESM .js files had extensionless relative imports (`from './middleware'`), which bundlers (vitest/esbuild/langgraphjs dev) tolerate but Node's native ESM resolver rejects with ERR_MODULE_NOT_FOUND — so `import '@threadplane/middleware/langgraph'` broke for plain-Node consumers. Add explicit `.js` to all relative imports so tsc emits Node-ESM-correct specifiers. Verified: native `node --input-type=module` import of the built package now loads all 9 exports (0.0.1 threw ERR_MODULE_NOT_FOUND); unit + integration tests still green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Bug found while live-smoking the JS LangGraph demo against the published
0.0.1.The emitted ESM
.jsfiles had extensionless relative imports (export { … } from './middleware'). Bundlers (vitest, esbuild,langgraphjs dev) tolerate this — which is why the unit/integration tests and the demo all passed — but Node's native ESM resolver rejects it withERR_MODULE_NOT_FOUND. Soimport '@threadplane/middleware/langgraph'from plain Node ESM (or strict NodeNext TS) was broken in0.0.1.Fix
Add explicit
.jsto every relative import in the source sotscemits Node-ESM-correct specifiers. Bump to0.0.2.Verified
node --input-type=moduleimport of the built package now loads all 9 exports (0.0.1threwERR_MODULE_NOT_FOUNDon the same call).After merge (maintainer)
Republish
@threadplane/middleware@0.0.2(tarball provided in chat; or via thepublish-middleware-npm.ymlOIDC workflow now that the package exists). Consumers on^0.0.1(incl. the newcockpit/langgraph/client-tools/nodedemo) pick it up automatically.🤖 Generated with Claude Code