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

支持关闭404嗅探 #23

Closed
lyh0371 opened this issue Oct 10, 2022 · 2 comments
Closed

支持关闭404嗅探 #23

lyh0371 opened this issue Oct 10, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@lyh0371
Copy link

lyh0371 commented Oct 10, 2022

场景:404嗅探虽然不影响功能, 但是会被监控平台统计到,可能影响运营系统报警
希望:支持用户手动关闭404嗅探

@fantasticsoul
Copy link
Collaborator

fantasticsoul commented Oct 11, 2022

hel-micro 3.9.4已支持,见提交:
ef74613

可设置skip404Sniff 来关闭此嗅探

await preFetchLib('xxx', {skip404Sniff:true});

@fantasticsoul
Copy link
Collaborator

404 嗅探存在的原因:

这个机制是因为 unpkg 的语义化版本的最新版本参数 latest 生效不及时才加的这个 404 请求
举个例子,假如 hel-lodash 版本为 2.1.7 我期望的:
https://unpkg.com/hel-lodash@latest/hel_dist/hel-meta.json
就马上返回的是 2.1.7 版本的元数据
https://unpkg.com/hel-lodash@2.1.7/hel_dist/hel-meta.json

如果此时我发布了2.1.8, 再访问 https://unpkg.com/hel-lodash@latest/hel_dist/hel-meta.json,依然返回 https://unpkg.com/hel-lodash@2.1.7/hel_dist/hel-meta.json
如果我用一个404嗅探,https://unpkg.com/hel-lodash/xxxxx-not-found 则会返回 https://unpkg.com/hel-lodash@2.1.8/xxxxx-not-found,此时hel-micro就可以提取到 2.1.8 作为最新的版本参数去请求元数据了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants