Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix babel register cache invalidation #14303

Merged
merged 1 commit into from
Feb 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: cache
Incredibly, @babel/register wasn't caching anything. This is because `setDirty()` must be called on the worker cache, otherwise the check at https://github.com/babel/babel/blob/main/packages/babel-register/src/worker/cache.js#L32 always fails.

I couldn't believe it when I started digging into why caching seemed to do nothing. Lazy! ;)
  • Loading branch information
cha0s authored Feb 24, 2022
commit afa200268c280f4b15d7d4bba09ef93f1208b0bd
1 change: 1 addition & 0 deletions packages/babel-register/src/worker/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function cacheLookup(opts, filename) {
cached: null,
store(value) {
cache[cacheKey] = { value, mtime: fileMtime };
registerCache.setDirty();
return value;
},
};
Expand Down