fix: known-template discovery must not follow symlinks - #297
Merged
Conversation
getKnownTemplates globs from the project root with a pattern that descends into every node_modules (to find generated `.marko` dirs), and fast-glob follows symlinks by default. pnpm layouts link node_modules as a cyclic symlink graph, so an optimized build's discovery walk never terminated and exhausted the heap (reproduced: infinite OOM at any heap size; 2.6s build with the fix). Templates generated under node_modules/.marko remain discoverable — that directory is real, not a link. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_d934036c
🦋 Changeset detectedLatest commit: 72a63c0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughKnown-template discovery during optimized builds now configures 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
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.
getKnownTemplatesglobs from the project root with**/node_modules/.marko/**in the pattern set — which forces the walker into every package tree — and fast-glob follows symlinks by default. pnpm layouts linknode_modulesas a cyclic symlink graph, so an optimized build's discovery walk never terminates and exhausts the heap (reproduced on a pnpm app: fatal OOM at 4 GiB and 8 GiB alike; CPU profile was ~95%getdents/openunder@nodelib/fs.walk).With
followSymbolicLinks: falsethe same build completes in 2.6s. Generated templates undernode_modules/.markoare still found (that directory is real, not a link); the only newly-missed case is.markofiles inside symlinked packages, which previously OOM'd rather than being found anyway.