diff options
| author | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2023-02-09 14:06:39 +0530 |
|---|---|---|
| committer | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2023-02-09 14:06:39 +0530 |
| commit | b6046c22deb4d00ca07a9eedd27c7e8eae064518 (patch) | |
| tree | 8f8b23f982cae92e8648dcd1081a46b132eb7dc6 | |
| parent | 0404234c26f6813025e9eedd9981e1536db28b2a (diff) | |
| download | banglar-bhumi-utils-b6046c22deb4d00ca07a9eedd27c7e8eae064518.tar.gz banglar-bhumi-utils-b6046c22deb4d00ca07a9eedd27c7e8eae064518.zip | |
Changed the output of scripts build to a seperate directory.
| -rw-r--r-- | config/webpack.config.js | 2 | ||||
| -rw-r--r-- | config/webpack/plugins/create-manifest-webpack-plugin/index.js | 2 | ||||
| -rw-r--r-- | config/webpack/plugins/inject-script-webpack-plugin.js | 10 |
3 files changed, 7 insertions, 7 deletions
diff --git a/config/webpack.config.js b/config/webpack.config.js index b4cd6cd..d90be46 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -38,7 +38,7 @@ for (const scriptRuntime in allScripts) { name: scriptRuntime, mode: "production", output: { - filename: `${scriptRuntime}.js` + filename: `scripts/${scriptRuntime}.js` }, resolve: { extensions: ["", ".ts", ".js"], diff --git a/config/webpack/plugins/create-manifest-webpack-plugin/index.js b/config/webpack/plugins/create-manifest-webpack-plugin/index.js index 7748cd9..5729ed9 100644 --- a/config/webpack/plugins/create-manifest-webpack-plugin/index.js +++ b/config/webpack/plugins/create-manifest-webpack-plugin/index.js @@ -42,7 +42,7 @@ class CreateManifestPlugin { for (const scriptPath in paths) { this.manifest.content_scripts.push({ matches: [`*://banglarbhumi.gov.in/${scriptPath}`], - js: [`${scriptRuntime}.js`], + js: [`scripts/${scriptRuntime}.js`], run_at: scriptRuntime }); } 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; } |
