From b1785a889f337460b29551bc7f85728aefd9df71 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Thu, 9 Feb 2023 22:18:58 +0530 Subject: Using a single webpack config for all scripts. --- config/webpack/plugins/create-manifest-webpack-plugin/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 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 fcfe689..7044be2 100644 --- a/config/webpack/plugins/create-manifest-webpack-plugin/index.js +++ b/config/webpack/plugins/create-manifest-webpack-plugin/index.js @@ -1,12 +1,14 @@ const { sources } = require("webpack"); const path = require("path"); +const scripts = require(path.resolve(process.env.SOURCE_DIR, "scripts.json")); + 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 }) { + constructor() { this.scripts = {}; this.manifest = require("./manifest-template.json"); for (const scriptType in scripts) { @@ -50,7 +52,7 @@ class CreateManifestPlugin { } } - compilation.updateAsset( + compilation.emitAsset( "manifest.json", new sources.RawSource(JSON.stringify(this.manifest)) ); -- cgit v1.2.3