Work around issue with Node 22 and Jiti (#15421)

Fixes #15374

If we always use Jiti the problem should, in theory, go away (I hope).
It does mean that loading configs is slower than it would be if they're
written in CJS but 🤷‍♂️

Wanna get this running with the integration tests to see if anything
breaks.
This commit is contained in:
Jordan Pittman 2024-12-17 13:43:33 -05:00 • committed by GitHub
parent f875ab9706
commit 0a836f76bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -33,6 +33,10 @@ function lazyJiti() {
export function loadConfig(path: string): Config {
let config = (function () {
// Always use jiti for now. There is a a bug that occurs in Node v22.12+
// where imported files return invalid results
return lazyJiti()(path)
// Always use jiti for ESM or TS files
if (
path &&