From f4a94bed13a8595ec8a15e3ea8315aeb5aecc744 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Sat, 9 Mar 2024 08:57:59 +0530 Subject: A lot of changes :) --- .../plugins/create-manifest-webpack-plugin/index.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'config/webpack/plugins/create-manifest-webpack-plugin/index.js') diff --git a/config/webpack/plugins/create-manifest-webpack-plugin/index.js b/config/webpack/plugins/create-manifest-webpack-plugin/index.js index 91ddf3e..da62bea 100644 --- a/config/webpack/plugins/create-manifest-webpack-plugin/index.js +++ b/config/webpack/plugins/create-manifest-webpack-plugin/index.js @@ -23,6 +23,7 @@ class CreateManifestPlugin { assets => { manifest.version = require(path.resolve(ROOT_DIR, "package.json")).version; manifest.content_scripts = []; + let resources = []; const arrangedScripts = {}; @@ -33,12 +34,15 @@ class CreateManifestPlugin { const scriptRuntime = getScriptRuntimeFromType(scriptType); if (typeof arrangedScripts[scriptPath][scriptRuntime] === "undefined") { - arrangedScripts[scriptPath][scriptRuntime] = []; - } + arrangedScripts[scriptPath][scriptRuntime] = []; + } - arrangedScripts[scriptPath][scriptRuntime].push(`scripts/${getFileNameHash(scriptType, scriptPath)}.js`); + arrangedScripts[scriptPath][scriptRuntime].push(`scripts/${getFileNameHash(scriptType, scriptPath)}.js`); + if (scriptType.startsWith("injected")) { + resources.push(`scripts/injected/${getFileNameHash(scriptType, scriptPath)}.js`); } } + } manifest.content_scripts.push({ matches: [`*://banglarbhumi.gov.in/BanglarBhumi/*`], @@ -66,8 +70,6 @@ class CreateManifestPlugin { } } - let resources = []; - for (const assetName in assets) { if (/^assets\/.*\.(jpg|png|gif)$/.test(assetName)) { resources.push(assetName); @@ -83,6 +85,8 @@ class CreateManifestPlugin { manifest.content_scripts[0].js.unshift(`shared/${getFileNameHash("injected-shared-modules", "shared")}.js`); } + manifest.content_scripts[0].js.unshift(`shared/${getFileNameHash("script-injector", "shared")}.js`); + if (resources.length > 0) { manifest.web_accessible_resources = [ { -- cgit v1.2.3