skip to content

Module Caching

0 questions

Modules execute once and are memoized in require.cache by resolved filename, which is what makes a module-level object a de facto singleton. Interviewers ask because it explains both shared state between importers and why tests leak state unless the cache is cleared between them.

questions

0 questions