Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/tla out of order cleanup #898

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

erm410
Copy link

@erm410 erm410 commented Feb 15, 2025

#729 happens because webpack's Top Level Await implementation allows for modules to be loaded in parallel. This breaks the assumption that a global __webpack_require__.$Refresh$, which contains information about the currently loading module, can be managed as a stack like data structure.

This change borrows the concept from webpack's own webpack/runtime/hot module replacement chunk that each module can receive its own copy of a "proxy" __webpack_require__. This proxy delegates all of its behavior to the global __webpack_require__ except for access to the $Refresh$ property. In practice this guarantees that __webpack_require__.$Refresh$ is isolated to the currently loading module, avoiding any chance of a race condition caused by parallel loading.

This has been found to solve the motivating issue in a 3000+ file (proprietary) Typescript/webpack build chain monorepo.

Copy link

codesandbox bot commented Feb 15, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

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.

1 participant