From 915947e3e7ab7c1fa07596ab4b13bf6e1cc50b76 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Wed, 8 Feb 2023 18:51:39 +0530 Subject: Cleaned code. --- .../webpack/plugins/create-manifest-webpack-plugin/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'config/webpack/plugins/create-manifest-webpack-plugin') diff --git a/config/webpack/plugins/create-manifest-webpack-plugin/index.js b/config/webpack/plugins/create-manifest-webpack-plugin/index.js index 4a07380..6bbb485 100644 --- a/config/webpack/plugins/create-manifest-webpack-plugin/index.js +++ b/config/webpack/plugins/create-manifest-webpack-plugin/index.js @@ -1,3 +1,4 @@ +const { sources } = require("webpack"); const path = require("path"); const { version } = require(path.resolve(process.env.ROOT_DIR, "package.json")); @@ -34,10 +35,10 @@ class CreateManifestPlugin { compilation.hooks.processAssets.tap( { name: "CreateManifestPlugin", - stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE, + stage: compiler.webpack.Compilation.PROCESS_ASSETS_ADDITIONAL, additionalAssets: true }, - assets => { + () => { this.manifest.version = version; this.manifest.content_scripts = [] @@ -64,8 +65,10 @@ class CreateManifestPlugin { } } - const { RawSource } = compiler.webpack.sources; - assets["manifest.json"] = new RawSource(Buffer.from(JSON.stringify(this.manifest))); + compilation.updateAsset( + "manifest.json", + new sources.RawSource(JSON.stringify(this.manifest)) + ); } ); }); -- cgit v1.2.3