Native dynamic imports (e.g. import('./foo')) are typically loaded by browsers with high priority. However, when targeting browsers without native or polyfillable support, Parcel inserts <script async> tags into the head, which are loaded with low priority. See https://addyosmani.com/blog/script-priorities/.
With that said, we should probably still include the async attribuite on these scripts as their execution order isn't important. One workaround to boost priority of async scripts is to also insert a <link rel="preload" as="script"> with an href with the same value as the script's src.
We should consider adding these link tags as well when loading js targeted at these environments.
Related: #6981
Native dynamic imports (e.g.
import('./foo')) are typically loaded by browsers with high priority. However, when targeting browsers without native or polyfillable support, Parcel inserts<script async>tags into the head, which are loaded with low priority. See https://addyosmani.com/blog/script-priorities/.With that said, we should probably still include the
asyncattribuite on these scripts as their execution order isn't important. One workaround to boost priority of async scripts is to also insert a<link rel="preload" as="script">with anhrefwith the same value as the script'ssrc.We should consider adding these link tags as well when loading js targeted at these environments.
Related: #6981