diff options
| author | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2023-03-26 22:39:07 +0530 |
|---|---|---|
| committer | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2023-03-26 22:39:07 +0530 |
| commit | 068a14ffa464d6cb0ccc5c3cec11d10d8cceae90 (patch) | |
| tree | b0d721ca44a705d6d554e3a93479eee51645d3e7 /config/webpack/plugins | |
| parent | d6682a1ed9acd31dbfdb9e645cc8230c61a268c3 (diff) | |
| download | banglar-bhumi-utils-068a14ffa464d6cb0ccc5c3cec11d10d8cceae90.tar.gz banglar-bhumi-utils-068a14ffa464d6cb0ccc5c3cec11d10d8cceae90.zip | |
Sharing code between scripts for reduced bundle size.
Diffstat (limited to 'config/webpack/plugins')
| -rw-r--r-- | config/webpack/plugins/create-manifest-webpack-plugin/index.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/config/webpack/plugins/create-manifest-webpack-plugin/index.js b/config/webpack/plugins/create-manifest-webpack-plugin/index.js index 1940c6e..77f5959 100644 --- a/config/webpack/plugins/create-manifest-webpack-plugin/index.js +++ b/config/webpack/plugins/create-manifest-webpack-plugin/index.js @@ -3,7 +3,9 @@ const path = require("path"); const { getScriptRuntimeFromType } = webpackRequire("utils/script-runtime"); const { getFileNameHash } = webpackRequire("utils/file-name-hash"); -const { formatScripts } = webpackRequire("utils/format-scripts"); +const scripts = webpackRequire("utils/scripts"); +const sharedModules = webpackRequire("utils/shared-modules"); +const manifest = webpackRequire("plugins/create-manifest-webpack-plugin/manifest-template.json"); class CreateManifestPlugin { apply(compiler) { @@ -15,8 +17,6 @@ class CreateManifestPlugin { additionalAssets: true }, assets => { - const scripts = formatScripts(require(path.resolve(SOURCE_DIR, "scripts.json"))); - const manifest = webpackRequire("plugins/create-manifest-webpack-plugin/manifest-template.json"); manifest.version = require(path.resolve(ROOT_DIR, "package.json")).version; manifest.content_scripts = []; @@ -37,9 +37,13 @@ class CreateManifestPlugin { const resources = []; - for (const assetName in assets) + for (const assetName in assets) { if (/^assets\/.*\.(jpg|png|gif)$/.test(assetName)) resources.push(assetName); + } + + for (const sharedModule of sharedModules) + resources.push(`shared/${sharedModule}.js`); if (resources.length > 0) { manifest.web_accessible_resources = [ |
