简体   繁体   English

确定我的客户使用的是 CDN 还是 NPM 版本的 JS 库的方法?

[英]Ways to identify if my clients are using the CDN or NPM versions of my JS library?

I am currently in the midst of thinking of launching an open sourced version of my library on NPM. However, I'm wondering if there is a way for me to know whether the clients are using my CDN/NPM especially.我目前正在考虑在 NPM 上发布我的库的开源版本。但是,我想知道是否有办法让我知道客户是否特别使用我的 CDN/NPM。

Is there anyway that this can actually be done?无论如何,这实际上可以做到吗?

I've thought about this and have come up with one idea so far:到目前为止,我已经考虑过这个问题并提出了一个想法:

  1. Adding a commit tag to the minified file, which allows me to see the commit hash of a version either from NPM, or from our own CDN.将提交标记添加到缩小文件,这使我可以看到来自 NPM 或来自我们自己的 CDN 的版本的提交 hash。

Would be good to hear if anyone else has ideas!很高兴听到其他人有想法!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM