aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack/plugins/inject-script-webpack-plugin.js
diff options
context:
space:
mode:
authorArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2023-02-09 14:06:39 +0530
committerArpit Chakladar <54011232+arpitchakladar@users.noreply.github.com>2023-02-09 14:06:39 +0530
commitb6046c22deb4d00ca07a9eedd27c7e8eae064518 (patch)
tree8f8b23f982cae92e8648dcd1081a46b132eb7dc6 /config/webpack/plugins/inject-script-webpack-plugin.js
parent0404234c26f6813025e9eedd9981e1536db28b2a (diff)
downloadbanglar-bhumi-utils-b6046c22deb4d00ca07a9eedd27c7e8eae064518.tar.gz
banglar-bhumi-utils-b6046c22deb4d00ca07a9eedd27c7e8eae064518.zip
Changed the output of scripts build to a seperate directory.
Diffstat (limited to 'config/webpack/plugins/inject-script-webpack-plugin.js')
-rw-r--r--config/webpack/plugins/inject-script-webpack-plugin.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/config/webpack/plugins/inject-script-webpack-plugin.js b/config/webpack/plugins/inject-script-webpack-plugin.js
index 592751d..98620ea 100644
--- a/config/webpack/plugins/inject-script-webpack-plugin.js
+++ b/config/webpack/plugins/inject-script-webpack-plugin.js
@@ -19,13 +19,13 @@ class InjectScriptPlugin {
async assets => {
for (const assetName in assets) {
if (assetName.endsWith(".js")) {
- let scriptEnd = 0;
const currentAssetContent = compilation.getAsset(assetName).source.source();
const scripts = {
before: "",
injected: "",
injected_and_loaded: ""
};
+ let scriptEnd = 0;
while (true) {
const start = currentAssetContent.indexOf("/*<--\t", scriptEnd + 1);
if (start < 0) {
@@ -33,13 +33,13 @@ class InjectScriptPlugin {
} else {
const end = currentAssetContent.indexOf("\t-->*/", start + 1);
if (end < 0) {
- throw Error("Failed to parse some scripts");
+ throw Error("Failed to parse scripts with document_start runtime");
} else {
- const scriptType = currentAssetContent.substring(start + 6, end);
- scriptEnd = currentAssetContent.indexOf("\n/*<---->*/", end + 1)
+ scriptEnd = currentAssetContent.indexOf("\n/*<---->*/", end + 1);
if (scriptEnd < 0) {
- break;
+ throw Error("Failed to parse scripts with document_start runtime");
}
+ const scriptType = currentAssetContent.substring(start + 6, end);
scripts[scriptType.trim()] += currentAssetContent.substring(end + 6, scriptEnd);
scriptEnd += 11;
}