2

When importing scripts in razor files, you could version them in this simple way:

<script src="~/lib/myscript.js" asp-append-version="true"></script>

How can I do an equivalent thing inside the module script:

<script type="module">
    import * as mynamespace from '/lib/myscript.js';
    ...
</script>

Does exists something that returns the string appended by the system?

import * as mynamespace from '/lib/myscript.js?version='@HTML.GetAspAppendVersionValue();
Daniele Licitra
  • 1,520
  • 21
  • 45

1 Answers1

0

I had this exact problem, see my answer here. Basically, you simulate asp-append-version by adding version numbers to your file names (e.g. MyScript.v1.js) then rename the file when you change it and let Visual Studio update all the file references for you.

Eric Mutta
  • 1,144
  • 1
  • 11
  • 15