This loads jquery only once:
<script type="module">
import "./js/jquery.js";
import "./js/jquery.js";
</script>
The same is true for:
<script type="module">
import "./js/jquery.js";
</script>
<script type="module">
import "./js/jquery.js";
</script>
But this loads jquery two times:
<script src="./js/jquery.js"></script>
<script type="module">
import "./js/jquery.js";
</script>
Is it possible somehow to tell the browser's ES6 modules resolver that after first
<script src="./js/jquery.js"></script>
jquery scirpt is allready loaded and it is possible to use it without involving network/disk cache request?
P.S. This is just investigation. I'm thinking how we can mix modern ES6 modules and "legacy code" (in modern browsers) together. I would prefer to load jquery plugin system through "old style <script>" since inline code depends on it.
I know that jquery is not good sample it doesn't have exports. Still we use it with babel import $ from jQuery; and I want to understand what kind of transformations should be done during transpiling to prepare code be loaded with ES6 modules native support. If you know such babel 7 plugins - this is also very valuable.