skip to Main Content

How do I determine the version number of a minified JS file? I’m using Visual Studio 2022 and the Bundler & Minifier VS Extension. I’m referencing the file in my view by version number, so I’d like a way to determine the current version number of the min.js file.

The file is being consumed in the project using a version number like so:

<script src="~/Scripts/thing/ourthing.min.js?v=1.8"></script>

I don’t see anything in the minified text to indicate what it might be. I tried just incrementing it to the next version number, but it didn’t include my change.

Copilot suggested the following grep command on the minified file, but it didn’t find anything:
grep -o ‘v[0-9]+.[0-9]+.[0-9]+’ file.min.js

2

Answers


  1. Chosen as BEST ANSWER

    You all were correct. There isn't a generated "version number" for my change. We just increment the version number so that the browser will request a new copy. It's working now after clearing my browser cache.


  2. The version number at the end there doesn’t actually change the content, it’s there for cache busting purposes.

    You need to make sure the minification process has run again after you made changes to the file.

    Also, note that copilot’s grep command is wrong for your version number. Observe that the pattern grep -o 'v[0-9]+.[0-9]+.[0-9]+' file.min.js contains three numeric groups (separated by two periods), but your version number only has two numbers (separated by a single period). Also, the version number in the search must be prefixed with the letter v before the first digit, but yours is not. This search would find a version number like v1.2.3, but not your 1.8.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search