fix: stack overflow when config have both default and named exports#49
Merged
sxzz merged 1 commit intoantfu-collective:mainfrom Nov 11, 2025
Merged
Conversation
1804c04 to
a3d5abb
Compare
sxzz
approved these changes
Nov 11, 2025
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.
Description
🧩 Backstory
After the 7.4.0 update, a
Maximum call stack size exceedederror started to occur when usingtaze, that started throwing errors with configurations that export both default and named exports simultaneously.🐛 Issue
After some debugging, I traced the issue back to this change, which introduced the faulty behavior. As I understand,
interopDefaultfunction tries to create a getter for the self-referentialdefaultkey and/or for the module property which already is the default object. This results in defining a self-referential getter (defaultValue.default→mod.default→defaultValue), which leads to infinite recursion when Node attempts to inspect or log the object, ultimately triggering the stack overflow.✔️ Fix
This PR prevents processing the
defaultkey or the module property which already is the default object when defining forwarded getters. By skipping these, we avoid creating a self-referential properties and eliminate the infinite recursion.🧪 Tests
All existing tests have passed.
Also, I’ve added several new tests covering the main scenarios that previously triggered the recursion.
🧾 Reproduction
unconfig-reproAdditional context
I’m not deeply familiar with the internal design of
unconfigand its ecosystem, so the approach may not be ideal.Feedback and further refinements are very welcome.