-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Feature request
@janicklas-ralph introduced the module/nomodule pattern in #7704, which allows modern browsers to load javascript through the use of es2015 modules, and therefore, more modern, less transpiled-down code based on the support vector of browsers supporting modules, while still offering more a fallback to less modern browsers.
However, the pull request still uses <link rel="preload" /> to preload the modules. As suggested in this Google Developers guide, and again today by Phill Walton using <link rel="modulepreload" /> would be more efficient, since it doesn't only download the script, but also starts processing and compiling it immediately - off the main thread.
One caveat though, is that modulepreload is only supported in chromium-based browsers.
Describe the solution you'd like
A configurable option to use modulepreload instead of preload for module files. Making this configurable allows optimizing for the bulk of an application's user-base. I guess keeping preload as the default makes sense for the time being.
Describe alternatives you've considered
Keeping preload as it is now, or alternatively, using modulepreload as default and making the tradeoff very clear in the documentation.