jiti icon indicating copy to clipboard operation
jiti copied to clipboard

Bug: jiti returns cached module when a JS config file is modified in the same process

Open zyyv opened this issue 1 month ago • 1 comments

Describe the bug

const jiti = createJiti(import.meta.url, {
  fsCache: false,
  moduleCache: false,
})

When using jiti to load JS configuration at runtime, modifying the configuration file and then reloading the same path will return the cached (old) export instead of the new file content. (TypeScript files work fine)

Reproduction

Tested PR: https://github.com/antfu-collective/unconfig/pull/46 (downstream) Test results show that TypeScript passed the test, but JavaScript failed.

Related PR: https://github.com/antfu-collective/unconfig/pull/47 (downstream) Since I was unfamiliar with jiti's code, I tried to fix the issue with some hacky behavior, but this created more problems, so I rolled back the behavior.


Thank you for maintaining jiti — this use case affects runtime config loading and hot-reload scenarios for projects that rely on jiti, and any guidance or fix would be greatly appreciated.

zyyv avatar Nov 11 '25 10:11 zyyv

Can't reproduce with jiti alone. Could you please check this minimal example?

kricsleo avatar Nov 11 '25 14:11 kricsleo