html-webpack-plugin 5.5.1 → 5.5.2
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/lib/child-compiler.js +1 -1
- package/lib/loader.js +3 -3
- package/package.json +2 -2
package/lib/child-compiler.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/** @typedef {import("webpack/lib/Compiler.js")} WebpackCompiler */
|
|
4
4
|
/** @typedef {import("webpack/lib/Chunk.js")} WebpackChunk */
|
|
5
5
|
'use strict';
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* @file
|
|
8
9
|
* This file uses webpack to compile a template with a child compiler.
|
|
@@ -10,7 +11,6 @@
|
|
|
10
11
|
* [TEMPLATE] -> [JAVASCRIPT]
|
|
11
12
|
*
|
|
12
13
|
*/
|
|
13
|
-
'use strict';
|
|
14
14
|
|
|
15
15
|
let instanceId = 0;
|
|
16
16
|
/**
|
package/lib/loader.js
CHANGED
|
@@ -23,16 +23,16 @@ module.exports = function (source) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// Skip .js files (unless it's explicitly enforced)
|
|
26
|
-
if (/\.js$/.test(this.resourcePath) && !force) {
|
|
26
|
+
if (/\.(c|m)?js$/.test(this.resourcePath) && !force) {
|
|
27
27
|
return source;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// The following part renders the template with lodash as a minimalistic loader
|
|
31
31
|
//
|
|
32
32
|
const template = _.template(source, { interpolate: /<%=([\s\S]+?)%>/g, variable: 'data', ...options });
|
|
33
|
-
// Use
|
|
33
|
+
// Use `eval("require")("lodash")` to enforce using the native nodejs require
|
|
34
34
|
// during template execution
|
|
35
|
-
return 'var _ =
|
|
35
|
+
return 'var _ = eval("require")(' + JSON.stringify(require.resolve('lodash')) + ');' +
|
|
36
36
|
'module.exports = function (templateParams) { with(templateParams) {' +
|
|
37
37
|
// Execute the lodash template
|
|
38
38
|
'return (' + template.source + ')();' +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "html-webpack-plugin",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.2",
|
|
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)",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"standard-version": "^9.3.0",
|
|
45
45
|
"style-loader": "2.0.0",
|
|
46
46
|
"typescript": "4.9.4",
|
|
47
|
-
"webpack": "^5.
|
|
47
|
+
"webpack": "^5.86.0",
|
|
48
48
|
"webpack-cli": "4.5.0",
|
|
49
49
|
"webpack-recompilation-simulator": "3.2.0"
|
|
50
50
|
},
|