script-ext-html-webpack-plugin
Version:
Enhances html-webpack-plugin functionality with async and defer attributes for script elements
24 lines (20 loc) • 416 B
JavaScript
;
const shouldAddResourceHints = options => {
return !(options.prefetch.test.length === 0 &&
options.preload.test.length === 0);
};
const createResourceHint = (rel, href) => {
return {
tagName: 'link',
selfClosingTag: true,
attributes: {
rel: rel,
href: href,
as: 'script'
}
};
};
module.exports = {
shouldAddResourceHints,
createResourceHint
};