Skip to content

Conversation

@astrochemx
Copy link
Contributor

@astrochemx astrochemx commented Nov 10, 2025

Description

🧩 Backstory

After the 7.4.0 update, a Maximum call stack size exceeded error started to occur when using taze, 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, interopDefault function tries to create a getter for the self-referential default key and/or for the module property which already is the default object. This results in defining a self-referential getter (defaultValue.defaultmod.defaultdefaultValue), 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 default key 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-repro

Additional context

I’m not deeply familiar with the internal design of unconfig and its ecosystem, so the approach may not be ideal.
Feedback and further refinements are very welcome.

@antfu antfu requested a review from sxzz November 11, 2025 05:20
@sxzz sxzz merged commit 61c87a2 into antfu-collective:main Nov 11, 2025
10 checks passed
@astrochemx astrochemx deleted the fix/stack-overflow branch November 11, 2025 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants