diff --git a/CHANGELOG.md b/CHANGELOG.md index 22a8edf0..c721c14f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change log +## 3.5.5 (2024-03-03) + +- fix: initialize the singleton of the Config only once + ## 3.5.4 (2024-03-03) - optimize: lazy load the plugin config file diff --git a/README.md b/README.md index 15365f5c..5bae2585 100644 --- a/README.md +++ b/README.md @@ -434,7 +434,7 @@ See [boilerplate](https://github.com/webdiscus/webpack-html-scss-boilerplate) - [integrityHashes](#hook-integrity-hashes) 1. [Plugin options](#plugin-options) - [test](#option-test) (RegEx to handle matching templates) - - [entry](#option-entry) (entry as a list of template files) + - [entry](#option-entry) (template as entry point) - [entry as an array](#option-entry-array) (array notation) - [entry as an object](#option-entry-object) (object notation) - [entry as a path](#option-entry-path) (find templates in a directory recursively) diff --git a/package.json b/package.json index df54561d..1259bc61 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "html-bundler-webpack-plugin", - "version": "3.5.4", + "version": "3.5.5", "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.", "keywords": [ "html", @@ -80,6 +80,10 @@ "types": "./plugins/favicons-bundler-plugin/index.d.ts", "require": "./plugins/favicons-bundler-plugin/index.js", "import": "./plugins/favicons-bundler-plugin/index.js" + }, + "./Config": { + "require": "./src/Common/Config.js", + "import": "./src/Common/Config.js" } }, "engines": { diff --git a/src/Common/Config.js b/src/Common/Config.js index f9ac4758..451047fa 100644 --- a/src/Common/Config.js +++ b/src/Common/Config.js @@ -13,10 +13,13 @@ class Config { }; static init(file) { - this.#configFile = path.isAbsolute(file) - ? require.resolve(file) - : // path relative to `./src/Common` - require.resolve(path.join('../', file)); + // initialize only once + if (!this.#configFile) { + this.#configFile = path.isAbsolute(file) + ? require.resolve(file) + : // path relative to `./src/Common` + require.resolve(path.join('../', file)); + } } static get() {