groupAssetsByElements(assetTags, scriptTarget) {
    /** @type {{ headTags: Array<HtmlTagObject>; bodyTags: Array<HtmlTagObject>; }} */
    const result = {
      headTags: [...assetTags.meta, ...assetTags.styles],
      bodyTags: [],
    };

    // Add script tags to head or body depending on
    // the htmlPluginOptions
    if (scriptTarget === "body") {
      result.bodyTags.push(...assetTags.scripts);
    } else {
      // If script loading is blocking add the scripts to the end of the head
      // If script loading is non-blocking add the scripts in front of the css files
      const insertPosition =
        this.options.scriptLoading === "blocking"
          ? result.headTags.length
          : assetTags.meta.length;

      result.headTags.splice(insertPosition, 0, ...assetTags.scripts);
    }

    return result;
  }
Group assets to head and body tags

@param {{
      scripts: Array<HtmlTagObject>;
      styles: Array<HtmlTagObject>;
      meta: Array<HtmlTagObject>;
    }} assetTags
@param {"body" | "head"} scriptTarget
@returns {{
      headTags: Array<HtmlTagObject>;
      bodyTags: Array<HtmlTagObject>;
    }}