Just wanted to add to what Mac Lockard said. The preload magic comment does not work currently without using something like the preload-webpack-plugin. I.e. no <link> tag is generated at runtime, it seems to need to already be present in the HTML.

I’ve read somewhere that this is because preloading implies the preloaded module is going to immediately start loading in parallel with the main module of the page. Dynamically generating a <link> tag for preloading would mean that the main module would have to load and processed first, then the <link> tag would be added, but by this point it won’t have “preloaded” as it will already be too late.

Prefetch works fine. It dynamically adds a <link> tag for prefetching the target bundle at runtime.

Written by

Web developer — https://www.sargalias.com. Specialising in front end development. I love programming and strive to be the best software developer I can be.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store