Skip to content

fix: clear js file cache when next load this file#47

Merged
sxzz merged 2 commits intoantfu-collective:mainfrom
zyyv:clear-js-cache
Nov 7, 2025
Merged

fix: clear js file cache when next load this file#47
sxzz merged 2 commits intoantfu-collective:mainfrom
zyyv:clear-js-cache

Conversation

@zyyv
Copy link
Contributor

@zyyv zyyv commented Nov 7, 2025

Description

jiti has a caching issue with JS files, even when the caching is disabled when creating the jiti instance. Please see the failed test case #46.

This PR attempts to manually remove all existing caches from the filepath to ensure that the file content is up-to-date on the next load.

/cc @sxzz

Linked Issues

close #46

Additional context

@sxzz
Copy link
Member

sxzz commented Nov 7, 2025

Is this a bug of jiti? Should we report it to upstream? Since we've already disabled cache for jiti.

@zyyv
Copy link
Contributor Author

zyyv commented Nov 7, 2025

Is this a bug of jiti? Should we report it to upstream? Since we've already disabled cache for jiti.

I think so. I looked at jiti's code, but I'm not familiar with it.

@antfu
Copy link
Member

antfu commented Nov 7, 2025

I don't know if it belongs to jiti, as it's technically not the cache of jiti but the Node's require. In that way, I think I am fine with the solution.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 7, 2025

Open in StackBlitz

npm i https://pkg.pr.new/unconfig-core@47
npm i https://pkg.pr.new/unconfig@47

commit: 0989500

@sxzz sxzz merged commit cc90b5f into antfu-collective:main Nov 7, 2025
11 checks passed
@sxzz
Copy link
Member

sxzz commented Nov 7, 2025

Could you please send an issue to jiti as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants