this is "modules.js" file before change
class myClass {
constructor() {
// do nothing
}
foo() {
alert("foo");
}
}
and this is "script.js" file before change.
import {
myClass
} from "modules.js";
const myInstance = new myClass();
myInstance.foo();
I have changed these files to like below:
modules.js
class myClass {
constructor() {
// do nothing
}
foo() {
alert("foo");
}
bar() {
alert("bar");
}
}
script.js
import {
myClass
} from "modules.js";
const myInstance = new myClass();
myInstance.foo();
myInstance.bar();
an then I uploaded these files to my server and accessed the page.
the <script> tag which calls "script.js" is written like this:
<script type="module" src="script.js?ver=<?php echo date('Y-m-dH:i:s'); ?>"></script>
and the page throwed an error like "myInstance.bar is not defined"
I guess the problem is this. cache of "script.js" has been refreshed by
?ver=<?php echo date('Y-m-dH:i:s'); ?>
this code, but "modules.js" didn't.
so I want to refresh client cache of a JS file which is imported in js, not used as source of <script> tag.
can you suggest me any way to refresh the cache(or file)?
thank you for reading my question.