aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack
diff options
context:
space:
mode:
authorArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2023-02-09 22:18:58 +0530
committerArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2023-02-09 22:18:58 +0530
commitb1785a889f337460b29551bc7f85728aefd9df71 (patch)
tree19fbc6837ea606e9597d7975aeda010186563544 /config/webpack
parent3817d68c29862211afad739131d457864ef86826 (diff)
downloadbanglar-bhumi-utils-b1785a889f337460b29551bc7f85728aefd9df71.tar.gz
banglar-bhumi-utils-b1785a889f337460b29551bc7f85728aefd9df71.zip
Using a single webpack config for all scripts.
Diffstat (limited to 'config/webpack')
-rw-r--r--config/webpack/plugins/create-manifest-webpack-plugin/index.js6
-rw-r--r--config/webpack/plugins/inject-script-webpack-plugin.js2
2 files changed, 5 insertions, 3 deletions
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))
);
diff --git a/config/webpack/plugins/inject-script-webpack-plugin.js b/config/webpack/plugins/inject-script-webpack-plugin.js
index 98620ea..b6525f6 100644
--- a/config/webpack/plugins/inject-script-webpack-plugin.js
+++ b/config/webpack/plugins/inject-script-webpack-plugin.js
@@ -18,7 +18,7 @@ class InjectScriptPlugin {
},
async assets => {
for (const assetName in assets) {
- if (assetName.endsWith(".js")) {
+ if (assetName.endsWith("document_start.js")) {
const currentAssetContent = compilation.getAsset(assetName).source.source();
const scripts = {
before: "",