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(mfsu): fix cache invalid caused by the getCacheDependency content containing regexp #10308

Merged
merged 3 commits into from
Nov 6, 2023

Conversation

Limsanity
Copy link
Contributor

修复 getCacheDependency 内容包含正则表达式导致缓存不正确的问题。

@vercel
Copy link

vercel bot commented Jan 16, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
umi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2023 11:44pm

@fz6m
Copy link
Contributor

fz6m commented Jan 16, 2023

@umijs/utils 有 lodash ,用 lodash 的方法。

另外再给一个有正则表达式的配置例子看看吧

@Limsanity
Copy link
Contributor Author

这里给了个示例。

@Limsanity
Copy link
Contributor Author

目前会使用到的正则的地方应该只有 externals 和 mfsu.exclude,两个都是和依赖相关,会走依赖比较的逻辑判断出变化,即使正则序列化的结果不正确好像也不会影响。不确定还有没有修复的必要?

@Limsanity
Copy link
Contributor Author

这么修复会带来另一个问题,例如变更一个不存在的依赖:exclude: /axios1/ -> exclude: /axios2/。序列化结果的比对不一致,导致依赖重新构建,但这个依赖其实是不存在的。

@fz6m
Copy link
Contributor

fz6m commented Jan 17, 2023

我觉得可以修,不考虑配错 regexp 的情况。

另外考虑到向后加更多字段可能含有 regexp 的话,处理了没有坏事,问问 @stormslowly 老师的意见 🌹 。

@codecov
Copy link

codecov bot commented Jan 17, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (bd4721f) 28.98% compared to head (9739010) 29.49%.

❗ Current head 9739010 differs from pull request most recent head 996a017. Consider uploading reports for the commit 996a017 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10308      +/-   ##
==========================================
+ Coverage   28.98%   29.49%   +0.51%     
==========================================
  Files         488      444      -44     
  Lines       14847    12902    -1945     
  Branches     3519     3145     -374     
==========================================
- Hits         4304     3806     -498     
+ Misses       9783     8505    -1278     
+ Partials      760      591     -169     
Files Coverage Δ
packages/bundler-webpack/src/dev.ts 0.00% <0.00%> (ø)

... and 214 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fz6m fz6m requested a review from stormslowly January 17, 2023 05:00
@stormslowly
Copy link
Member

用户修改了配置,导致重新构建,这种情况是符合预期的。

@stormslowly
Copy link
Member

LGTM

PS :不过未来还是看看有没有更加通用的 serialize 和 deSerilaize 的方案,一次性解决掉。

@fz6m
Copy link
Contributor

fz6m commented Nov 6, 2023

这是一个关于缓存失效较重要的一个 PR ,故合并。

@fz6m fz6m merged commit b3b956a into umijs:master Nov 6, 2023
21 checks passed
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