How to reload a dynamically loaded ES6 module (using import() as a function) without reloading the whole page?

Viewed 1841

The following code will always log the same message even if the module has changed on the server, regardless of Cache-Control headers sent:

import('http://example.com/script.mjs').then(m => console.log(m.default))

unless the whole page is reloaded. Is there a programmatic way to bust the dynamic import cache, similar to delete require.cache[...] in NodeJS?

0 Answers
Related