If I programmatically include a <script>
tag with a src
attribute pointing to a webpack entrypoint, the runtime executes it the first time it is attached to the DOM. However, if I then remove that script tag and re-insert a new one with the same src
, it does not run again (even if a cache-busting querystring is appended). Presumably this is due to webpack's runtime module caching, or something similar (but manually popping the webpackChunk array does not work: the chunk is re-added to the array without re-running the script). However, I need this script to re-run every time it is reinserted into the DOM. How can I achieve this?