Search code examples
javascriptnpmnetwork-programmingcdn

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.

Is there anyway that this can actually be done?


Solution

  • 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.

    Would be good to hear if anyone else has ideas!