aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack/loader/count-imports-loader.js
diff options
context:
space:
mode:
Diffstat (limited to 'config/webpack/loader/count-imports-loader.js')
-rw-r--r--config/webpack/loader/count-imports-loader.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/config/webpack/loader/count-imports-loader.js b/config/webpack/loader/count-imports-loader.js
index 2586332..ef832bf 100644
--- a/config/webpack/loader/count-imports-loader.js
+++ b/config/webpack/loader/count-imports-loader.js
@@ -1,6 +1,15 @@
import { ImportManager } from "import-manager";
+
import sharedModules from "../utils/shared-modules.js";
+/**
+ * Webpack loader that counts how many times each shared module is imported.
+ * This count is used later to determine which shared modules need to be
+ * included in the compiled output.
+ *
+ * @param {string} source - The source code of the current module.
+ * @returns {string} The unmodified source (this loader is side-effect only).
+ */
export default function(source) {
const { sharedModulesImportedCount } = this.getOptions();
const manager = new ImportManager(source);