Repository navigation
fix(mcp-slicer): static-import renderDirectivesAsText — unblock DEV unit-tests bundle step - #3036
Merged
Merged
Conversation
…nes it (#3029 regression)
This was referenced Nov 6, 2026
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.
Problem
The
unit testsCI job is red on DEV (and was on PR #3033 before it merged). It fails in the bundle-generation prestep (node scripts/bundle-shared.cjs), before any test runs:Root cause
PR #3033's commit
4c6558a48("lazy-import renderDirectivesAsText to survive CF runtime") replaced a static import with a lazyimport()+ fallback:esbuild resolves string-literal dynamic imports relative to the source file. From
packages/mcp/,./_shared/parsers.bundle.mjspoints atpackages/mcp/_shared/— a directorybundle-shared.cjsnever emits (parsers.bundle.mjs is written only intosrv/lib/_shared/). esbuild can't resolve it, so building@tutorials/mcp→mcp.bundle.mjsfails.The #3029 pattern was misapplied: the slicer always reaches CF runtime bundled into
srv/lib/_shared/mcp.bundle.mjs, so a static import is inlined at build time and needs noscripts/parsers/source on disk — exactly like the siblingcollectTroubleshootEntriesstatic import one line above it.Fix
Revert
renderDirectivesAsTextto a static import, matchingcollectTroubleshootEntries. esbuild inlines it; no dynamic import, no unresolvable fallback path, no CF-runtime gap. (−14/+8, one file.)Verification
Reproduced the exact CI error in an isolated esbuild 0.28.2 harness (same version as CI) against the real source:
BUILD FAIL: Could not resolve "./_shared/parsers.bundle.mjs" @ packages/mcp/tutorial-step-slicer.js:32BUILD OK; esbuild metafile confirmsdirectives.tsis included andrenderDirectivesAsTextis inlined into the output bundle.🤖 Generated with Claude Code