aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack
diff options
context:
space:
mode:
Diffstat (limited to 'config/webpack')
-rw-r--r--config/webpack/plugins/create-manifest-webpack-plugin/index.js3
-rw-r--r--config/webpack/utils/file-name-hash.js3
2 files changed, 5 insertions, 1 deletions
diff --git a/config/webpack/plugins/create-manifest-webpack-plugin/index.js b/config/webpack/plugins/create-manifest-webpack-plugin/index.js
index 5729ed9..fcfe689 100644
--- a/config/webpack/plugins/create-manifest-webpack-plugin/index.js
+++ b/config/webpack/plugins/create-manifest-webpack-plugin/index.js
@@ -3,6 +3,7 @@ const path = require("path");
const { version } = require(path.resolve(process.env.ROOT_DIR, "package.json"));
const { getScriptRuntimeFromType } = require(path.resolve(process.env.CONFIG_DIR, "webpack/utils/script-runtime"));
+const { getFileNameHash } = require(path.resolve(process.env.CONFIG_DIR, "webpack/utils/file-name-hash"));
class CreateManifestPlugin {
constructor({ scripts }) {
@@ -42,7 +43,7 @@ class CreateManifestPlugin {
for (const scriptPath in paths) {
this.manifest.content_scripts.push({
matches: [`*://banglarbhumi.gov.in/${scriptPath}`],
- js: [`scripts/${scriptRuntime}.js`],
+ js: [`scripts/${getFileNameHash(scriptPath)}/${scriptRuntime}.js`],
run_at: scriptRuntime
});
}
diff --git a/config/webpack/utils/file-name-hash.js b/config/webpack/utils/file-name-hash.js
new file mode 100644
index 0000000..e3988a9
--- /dev/null
+++ b/config/webpack/utils/file-name-hash.js
@@ -0,0 +1,3 @@
+const crypto = require("crypto");
+
+module.exports.getFileNameHash = fileName => crypto.createHash("md5").update(fileName).digest("hex").substring(16);