This PR fixes a race condition that when importing the same id in parallel from several places (using await import()) the jiti was picking the (still) evaluating module without valid exports.
Context: Found it while investigating https://github.com/nuxt/nuxt/pull/27479, however this issue is just likely simply revealed with other perf improvements that increased the chance of this race.
Update: reverted in v1.21.5 as hotfix for circular dep support (#246) and added back in https://github.com/unjs/jiti/pull/247
This PR fixes a race condition that when importing the same
id
in parallel from several places (usingawait import()
) the jiti was picking the (still) evaluating module without valid exports.Context: Found it while investigating https://github.com/nuxt/nuxt/pull/27479, however this issue is just likely simply revealed with other perf improvements that increased the chance of this race.