Fix load-order issue that could cause overrides to error #384
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 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
npm run lintand updated code style accordinglynpm run testpasses