html-webpack-plugin
Advanced tools
Comparing version 5.5.4 to 5.6.0
@@ -81,5 +81,5 @@ // @ts-check | ||
// Assert correct option spelling | ||
if (options.scriptLoading !== 'defer' && options.scriptLoading !== 'blocking' && options.scriptLoading !== 'module') { | ||
if (options.scriptLoading !== 'defer' && options.scriptLoading !== 'blocking' && options.scriptLoading !== 'module' && options.scriptLoading !== 'systemjs-module') { | ||
/** @type {Logger} */ | ||
(this.logger).error('The "scriptLoading" option need to be set to "defer", "blocking" or "module"'); | ||
(this.logger).error('The "scriptLoading" option need to be set to "defer", "blocking" or "module" or "systemjs-module"'); | ||
} | ||
@@ -798,2 +798,4 @@ | ||
attributes.type = 'module'; | ||
} else if (this.options.scriptLoading === 'systemjs-module') { | ||
attributes.type = 'systemjs-module'; | ||
} | ||
@@ -800,0 +802,0 @@ |
@@ -16,3 +16,2 @@ // @ts-check | ||
let instanceId = 0; | ||
/** | ||
@@ -28,4 +27,2 @@ * The HtmlWebpackChildCompiler is a helper to allow reusing one childCompiler | ||
constructor (templates) { | ||
/** Id for this ChildCompiler */ | ||
this.id = instanceId++; | ||
/** | ||
@@ -115,8 +112,8 @@ * @type {string[]} templateIds | ||
// Generate output file names | ||
const temporaryTemplateNames = this.templates.map((template, index) => `__child-HtmlWebpackPlugin_${index}-${this.id}`); | ||
const temporaryTemplateNames = this.templates.map((template, index) => `__child-HtmlWebpackPlugin_${index}-${template}`); | ||
// Add all templates | ||
this.templates.forEach((template, index) => { | ||
new EntryPlugin(childCompiler.context, 'data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;', `HtmlWebpackPlugin_${index}-${this.id}`).apply(childCompiler); | ||
new EntryPlugin(childCompiler.context, template, `HtmlWebpackPlugin_${index}-${this.id}`).apply(childCompiler); | ||
new EntryPlugin(childCompiler.context, 'data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;', `HtmlWebpackPlugin_${index}-${template}`).apply(childCompiler); | ||
new EntryPlugin(childCompiler.context, template, `HtmlWebpackPlugin_${index}-${template}`).apply(childCompiler); | ||
}); | ||
@@ -123,0 +120,0 @@ |
{ | ||
"name": "html-webpack-plugin", | ||
"version": "5.5.4", | ||
"version": "5.6.0", | ||
"license": "MIT", | ||
@@ -59,4 +59,13 @@ "description": "Simplifies creation of HTML files to serve your webpack bundles", | ||
"peerDependencies": { | ||
"@rspack/core": "0.x || 1.x", | ||
"webpack": "^5.20.0" | ||
}, | ||
"peerDependenciesMeta": { | ||
"@rspack/core": { | ||
"optional": true | ||
}, | ||
"webpack": { | ||
"optional": true | ||
} | ||
}, | ||
"keywords": [ | ||
@@ -63,0 +72,0 @@ "webpack", |
@@ -93,5 +93,5 @@ [![npm][npm]][npm-url] | ||
* [html-webpack-plugin-django](https://github.com/TommasoAmici/html-webpack-plugin-django) a Webpack plugin to inject Django static tags. | ||
* [html-webpack-inject-attributes-plugin](https://github.com/dyw934854565/html-webpack-inject-attributes-plugin) add extra attributes to inject assetTags. | ||
* [js-entry-webpack-plugin](https://github.com/liam61/html-webpack-plugin) creates webpack bundles into your js entry | ||
<h2 align="center">Usage</h2> | ||
@@ -155,3 +155,3 @@ | ||
|**`publicPath`**|`{String\|'auto'}`|`'auto'`|The publicPath used for script and link tags| | ||
|**`scriptLoading`**|`{'blocking'\|'defer'\|'module'}`|`'defer'`| Modern browsers support non blocking javascript loading (`'defer'`) to improve the page startup performance. Setting to `'module'` adds attribute [`type="module"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#applying_the_module_to_your_html). This also implies "defer", since modules are automatically deferred. | | ||
|**`scriptLoading`**|`{'blocking'\|'defer'\|'module'\|'systemjs-module'}`|`'defer'`| Modern browsers support non blocking javascript loading (`'defer'`) to improve the page startup performance. Setting to `'module'` adds attribute [`type="module"`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#applying_the_module_to_your_html). This also implies "defer", since modules are automatically deferred. | | ||
|**`favicon`**|`{String}`|``|Adds the given favicon path to the output HTML| | ||
@@ -158,0 +158,0 @@ |**`meta`**|`{Object}`|`{}`|Allows to inject `meta`-tags. E.g. `meta: {viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'}`| |
@@ -101,3 +101,3 @@ import { AsyncSeriesWaterfallHook } from "tapable"; | ||
*/ | ||
scriptLoading?: "blocking" | "defer" | "module"; | ||
scriptLoading?: "blocking" | "defer" | "module" | "systemjs-module"; | ||
/** | ||
@@ -104,0 +104,0 @@ * Inject meta tags |
119960
7
2260