The latest version of Django (3.2) introduced a feature called ManifestStaticFilesStorage, which adds a hash value to JavaScript files that are called from a template. While this works correctly for direct script references, it doesn't affect imported JavaScript files within those scripts. The ManifestStaticFilesStorage documentation mentions how this hashing is done for CSS files, but there is no clear instruction on achieving the same for JavaScript files. Any ideas on how to make this work seamlessly?
For instance, consider the following line in an HTML template:
<script src="{% static 'myapp/js/myjavascript.js' %}" type="module"></script>
In the browser, this line is transformed as expected:
<script src="/static/myapp/js/myjavascript.12345abc.js" type="module"></script>
However, inside the 'myjavascript.js' file, any imported JavaScript files remain unaffected, potentially leading to cached versions being used instead of updated ones.
import {func1, func2, func3} from './javascript_helper_lib.js';