EcmaScript modules require a rel=modulepreload instead of rel=preload: https://web.dev/articles/modulepreload
It would be nice if the extension would reflect that. An simple approach would be to check if the file extension is .mjs. Something like this in Classes/Http/ResourcePusher.php:addPreloadHeaderToResponse():
if(str_contains($uri, '.mjs')) {
return $response->withAddedHeader('Link', '<' . htmlspecialchars(PathUtility::getAbsoluteWebPath($uri)) . '>; rel=modulepreload; as=' . $type);
} else {
return $response->withAddedHeader('Link', '<' . htmlspecialchars(PathUtility::getAbsoluteWebPath($uri)) . '>; rel=preload; as=' . $type);
}
EcmaScript modules require a
rel=modulepreloadinstead ofrel=preload: https://web.dev/articles/modulepreloadIt would be nice if the extension would reflect that. An simple approach would be to check if the file extension is
.mjs. Something like this inClasses/Http/ResourcePusher.php:addPreloadHeaderToResponse():