html-webpack-plugin 5.4.0 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [5.5.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.4.0...v5.5.0) (2021-10-25)
6
+
7
+
8
+ ### Features
9
+
10
+ * Support type=module via scriptLoading option ([1e42625](https://github.com/jantimon/html-webpack-plugin/commit/1e4262528ff02a83e1fc7739b42472680fd205c2)), closes [#1663](https://github.com/jantimon/html-webpack-plugin/issues/1663)
11
+
5
12
  ### [5.4.0](https://github.com/jantimon/html-webpack-plugin/compare/v5.3.2...v5.3.3) (2021-10-15)
6
13
 
7
14
  ### Features
package/README.md CHANGED
@@ -149,7 +149,7 @@ Allowed values are as follows:
149
149
  |**`templateParameters`**|`{Boolean\|Object\|Function}`| `false`| Allows to overwrite the parameters used in the template - see [example](https://github.com/jantimon/html-webpack-plugin/tree/master/examples/template-parameters) |
150
150
  |**`inject`**|`{Boolean\|String}`|`true`|`true \|\| 'head' \|\| 'body' \|\| false` Inject all assets into the given `template` or `templateContent`. When passing `'body'` all javascript resources will be placed at the bottom of the body element. `'head'` will place the scripts in the head element. Passing `true` will add it to the head/body depending on the `scriptLoading` option. Passing `false` will disable automatic injections. - see the [inject:false example](https://github.com/jantimon/html-webpack-plugin/tree/master/examples/custom-insertion-position)|
151
151
  |**`publicPath`**|`{String\|'auto'}`|`'auto'`|The publicPath used for script and link tags|
152
- |**`scriptLoading`**|`{'blocking'\|'defer'}`|`'defer'`| Modern browsers support non blocking javascript loading (`'defer'`) to improve the page startup performance. |
152
+ |**`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. |
153
153
  |**`favicon`**|`{String}`|``|Adds the given favicon path to the output HTML|
154
154
  |**`meta`**|`{Object}`|`{}`|Allows to inject `meta`-tags. E.g. `meta: {viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no'}`|
155
155
  |**`base`**|`{Object\|String\|false}`|`false`|Inject a [`base`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base) tag. E.g. `base: "https://example.com/path/page.html`|
package/index.js CHANGED
@@ -70,7 +70,7 @@ class HtmlWebpackPlugin {
70
70
  this.options = options;
71
71
 
72
72
  // Assert correct option spelling
73
- assert(options.scriptLoading === 'defer' || options.scriptLoading === 'blocking', 'scriptLoading needs to be set to "defer" or "blocking');
73
+ assert(options.scriptLoading === 'defer' || options.scriptLoading === 'blocking' || options.scriptLoading === 'module', 'scriptLoading needs to be set to "defer", "blocking" or "module"');
74
74
  assert(options.inject === true || options.inject === false || options.inject === 'head' || options.inject === 'body', 'inject needs to be set to true, false, "head" or "body');
75
75
 
76
76
  // Default metaOptions if no template is provided
@@ -741,7 +741,8 @@ function hookIntoCompiler (compiler, options, plugin) {
741
741
  voidTag: false,
742
742
  meta: { plugin: 'html-webpack-plugin' },
743
743
  attributes: {
744
- defer: options.scriptLoading !== 'blocking',
744
+ defer: options.scriptLoading === 'defer',
745
+ type: options.scriptLoading === 'module' ? 'module' : undefined,
745
746
  src: scriptAsset
746
747
  }
747
748
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-webpack-plugin",
3
- "version": "5.4.0",
3
+ "version": "5.5.0",
4
4
  "license": "MIT",
5
5
  "description": "Simplifies creation of HTML files to serve your webpack bundles",
6
6
  "author": "Jan Nicklas <j.nicklas@me.com> (https://github.com/jantimon)",
@@ -32,9 +32,9 @@
32
32
  "commitizen": "^4.2.4",
33
33
  "css-loader": "5.0.1",
34
34
  "cz-conventional-changelog": "2.1.0",
35
- "dir-compare": "1.7.2",
35
+ "dir-compare": "^3.3.0",
36
36
  "html-loader": "2.1.1",
37
- "jest": "26.5.3",
37
+ "jest": "^27.2.5",
38
38
  "mini-css-extract-plugin": "^1.6.0",
39
39
  "pug": "3.0.2",
40
40
  "pug-loader": "2.4.0",
@@ -52,7 +52,7 @@
52
52
  "@types/html-minifier-terser": "^6.0.0",
53
53
  "html-minifier-terser": "^6.0.2",
54
54
  "lodash": "^4.17.21",
55
- "pretty-error": "^3.0.4",
55
+ "pretty-error": "^4.0.0",
56
56
  "tapable": "^2.0.0"
57
57
  },
58
58
  "peerDependencies": {
package/typings.d.ts CHANGED
@@ -96,7 +96,7 @@ declare namespace HtmlWebpackPlugin {
96
96
  *
97
97
  * @default 'defer'
98
98
  */
99
- scriptLoading?: "blocking" | "defer";
99
+ scriptLoading?: "blocking" | "defer" | "module";
100
100
  /**
101
101
  * Inject meta tags
102
102
  */