Loading...
<link rel="preload" href="/app.js" as="script">
<script type="module" src="/app.js"></script><link rel="modulepreload" href="/app.js">
<script type="module" src="/app.js"></script>modulepreload fetches the file in module mode, so the module script reuses it instead of downloading it again.
rel='preload', so it is fetched twice.rel='modulepreload', not rel='preload' as='script'.href matches the exact URL the module is imported from.Browsers may fetch the dependencies, but it is not guaranteed, so list important dependencies as their own modulepreload links.
No, it fetches and parses the module ahead of time. The code runs only when the module is imported.