From b1a42c8dea08d89a7df98a2c499fe3987ebfb856 Mon Sep 17 00:00:00 2001 From: Amaury Tobias Quiroz Date: Fri, 19 Mar 2021 22:51:57 -0600 Subject: [PATCH] fix: support rel="modulepreload" on assetbundle as javascript (#621) In some bundler enviroments like vite the output on index.html uses link tag with rel="modulepreload" to load javascript, add support to handle this files on assetbundle, more info https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/modulepreload fix #620 Co-authored-by: amaury-tobias --- v2/internal/html/assetbundle.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/v2/internal/html/assetbundle.go b/v2/internal/html/assetbundle.go index 414986e0f..cf56bb40e 100644 --- a/v2/internal/html/assetbundle.go +++ b/v2/internal/html/assetbundle.go @@ -112,6 +112,9 @@ func (a *AssetBundle) processHTML(htmldata string) error { if attr.Key == "as" && attr.Val == "script" { asset.Type = AssetTypes.JS } + if attr.Key == "rel" && attr.Val == "modulepreload" { + asset.Type = AssetTypes.JS + } } // Ensure we don't include duplicates