Skip to content

Commit 80264f5

Browse files
committed
fix: initialize the singleton of the Config only once
1 parent b156817 commit 80264f5

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change log
22

3+
## 3.5.5 (2024-03-03)
4+
5+
- fix: initialize the singleton of the Config only once
6+
37
## 3.5.4 (2024-03-03)
48

59
- optimize: lazy load the plugin config file

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ See [boilerplate](https://github.com/webdiscus/webpack-html-scss-boilerplate)
434434
- [integrityHashes](#hook-integrity-hashes)
435435
1. [Plugin options](#plugin-options)
436436
- [test](#option-test) (RegEx to handle matching templates)
437-
- [entry](#option-entry) (entry as a list of template files)
437+
- [entry](#option-entry) (template as entry point)
438438
- [entry as an array](#option-entry-array) (array notation)
439439
- [entry as an object](#option-entry-object) (object notation)
440440
- [entry as a path](#option-entry-path) (find templates in a directory recursively)

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "html-bundler-webpack-plugin",
3-
"version": "3.5.4",
3+
"version": "3.5.5",
44
"description": "HTML bundler plugin for webpack handles a template as an entry point, extracts CSS and JS from their sources referenced in HTML, supports template engines like Eta, EJS, Handlebars, Nunjucks.",
55
"keywords": [
66
"html",
@@ -80,6 +80,10 @@
8080
"types": "./plugins/favicons-bundler-plugin/index.d.ts",
8181
"require": "./plugins/favicons-bundler-plugin/index.js",
8282
"import": "./plugins/favicons-bundler-plugin/index.js"
83+
},
84+
"./Config": {
85+
"require": "./src/Common/Config.js",
86+
"import": "./src/Common/Config.js"
8387
}
8488
},
8589
"engines": {

src/Common/Config.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ class Config {
1313
};
1414

1515
static init(file) {
16-
this.#configFile = path.isAbsolute(file)
17-
? require.resolve(file)
18-
: // path relative to `./src/Common`
19-
require.resolve(path.join('../', file));
16+
// initialize only once
17+
if (!this.#configFile) {
18+
this.#configFile = path.isAbsolute(file)
19+
? require.resolve(file)
20+
: // path relative to `./src/Common`
21+
require.resolve(path.join('../', file));
22+
}
2023
}
2124

2225
static get() {

0 commit comments

Comments
 (0)