aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack/utils/scripts.js
diff options
context:
space:
mode:
authorArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2023-03-26 22:39:07 +0530
committerArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2023-03-26 22:39:07 +0530
commit068a14ffa464d6cb0ccc5c3cec11d10d8cceae90 (patch)
treeb0d721ca44a705d6d554e3a93479eee51645d3e7 /config/webpack/utils/scripts.js
parentd6682a1ed9acd31dbfdb9e645cc8230c61a268c3 (diff)
downloadbanglar-bhumi-utils-068a14ffa464d6cb0ccc5c3cec11d10d8cceae90.tar.gz
banglar-bhumi-utils-068a14ffa464d6cb0ccc5c3cec11d10d8cceae90.zip
Sharing code between scripts for reduced bundle size.
Diffstat (limited to 'config/webpack/utils/scripts.js')
-rw-r--r--config/webpack/utils/scripts.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/config/webpack/utils/scripts.js b/config/webpack/utils/scripts.js
new file mode 100644
index 0000000..2196737
--- /dev/null
+++ b/config/webpack/utils/scripts.js
@@ -0,0 +1,16 @@
+const path = require("path");
+const scripts = require(path.resolve(SOURCE_DIR, "scripts.json"));
+
+const formattedScripts = {};
+
+for (const scriptType in scripts) {
+ const currentScripts = scripts[scriptType];
+ for (const scriptName in currentScripts) {
+ const scriptPath = currentScripts[scriptName];
+ formattedScripts[scriptPath] = formattedScripts[scriptPath] || {};
+ formattedScripts[scriptPath][scriptType] = formattedScripts[scriptPath][scriptType] || [];
+ formattedScripts[scriptPath][scriptType].push(scriptName);
+ }
+}
+
+module.exports = formattedScripts;