aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack/loaders
diff options
context:
space:
mode:
Diffstat (limited to 'config/webpack/loaders')
-rw-r--r--config/webpack/loaders/scoped-loader.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/config/webpack/loaders/scoped-loader.js b/config/webpack/loaders/scoped-loader.js
index 3b68ba6..1be58a4 100644
--- a/config/webpack/loaders/scoped-loader.js
+++ b/config/webpack/loaders/scoped-loader.js
@@ -1,5 +1,18 @@
const path = require("path");
+const scripts = require(path.resolve(process.env.SOURCE_DIR, "scripts.json"));
+
+const getScriptType = scriptName => {
+ for (const scriptType in scripts) {
+ if (scripts[scriptType][scriptName]) {
+ return scriptType;
+ }
+ }
+ return "undefined_script";
+};
+
module.exports = function (source) {
- return `/**\t${path.basename(this.resourcePath)}\t**/\n(() => {\n${source}\n})();`
+ return `/*<--\t${getScriptType(path.basename(this.resourcePath))}\t-->*/
+(() => {\n${source}\n})();
+/*<---->*/`
};