Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@afischer
Copy link
Member

Description of Change

It has been a known issue for a while that there are a few circular dependencies in the app. In Node 18+, it seems that the changes in module resolution have finally caused some issues when the dynamic requires used to support overrides are called. This has created a situation where reaching for some functions can have unexpected behavior in deployed environments where

This PR simply moves some functions around to sidestep the issue in this aging app, but as the issue notes, we will have to address this sooner or later, and will likely crop back up in the future.

Testing

Testing this is a bit tricky, as it really only appears when overrides are present. You can attempt to create some overrides by following the instrux in the readme if you would like.

I have tested this using the Dockerized setup we use for our internal NYT deploy. By using the require structure, we get around the issue.

This is a very small change and should have no change to the actual functions or their behavior.

Related Issue

See #361

Checklist

  • Ran npm run lint and updated code style accordingly
  • npm run test passes
  • PR has a description and all contributors/stakeholder are noted/cc'ed
  • tests are updated and/or added to cover new code
  • relevant documentation is changed and/or added

@afischer afischer requested a review from achavez July 16, 2025 16:53
@afischer afischer self-assigned this Jul 16, 2025
Copy link
Contributor

@achavez achavez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WOW some great debugging, I imagine, to work this out. 💯

Looks good to me and makes sense

@afischer afischer merged commit be5b3d7 into main Jul 16, 2025
4 checks passed
@afischer afischer deleted the circular-dep-load-order branch July 16, 2025 16:57
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