From 04f8f2aae1e3ed40bb74aed819dcf79e919c64cc Mon Sep 17 00:00:00 2001 From: StefanMoCoAt Date: Mon, 16 Mar 2026 20:56:38 +0100 Subject: [PATCH] Add new strategies (E-H) to locate `sqlite.worker.js` in webpack configuration --- .../webpack.config.d/sqlite-config.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/frontend/shells/meldestelle-portal/webpack.config.d/sqlite-config.js b/frontend/shells/meldestelle-portal/webpack.config.d/sqlite-config.js index 2eb3e5f7..8f5b6f2f 100644 --- a/frontend/shells/meldestelle-portal/webpack.config.d/sqlite-config.js +++ b/frontend/shells/meldestelle-portal/webpack.config.d/sqlite-config.js @@ -58,6 +58,14 @@ const pathB = path.resolve(process.cwd(), '../../core/local-db/src/jsMain/resour const pathC = path.resolve(__dirname, '../../../../core/local-db/src/jsMain/resources/sqlite.worker.js'); // Strategy D: From processedResources of local-db module (Kotlin/JS build output) const pathD = path.resolve(__dirname, '../../../../core/local-db/build/processedResources/js/main/sqlite.worker.js'); +// Strategy E: Via process.cwd() 4 levels up = project root (works when Webpack runs from build/js/packages//) +const pathE = path.resolve(process.cwd(), '../../../../frontend/core/local-db/src/jsMain/resources/sqlite.worker.js'); +// Strategy F: processedResources via process.cwd() 4 levels up +const pathF = path.resolve(process.cwd(), '../../../../frontend/core/local-db/build/processedResources/js/main/sqlite.worker.js'); +// Strategy G: Via process.cwd() when Gradle runs from project root +const pathG = path.resolve(process.cwd(), 'frontend/core/local-db/src/jsMain/resources/sqlite.worker.js'); +// Strategy H: processedResources via process.cwd() from project root +const pathH = path.resolve(process.cwd(), 'frontend/core/local-db/build/processedResources/js/main/sqlite.worker.js'); let workerSourcePath = null; @@ -73,12 +81,28 @@ if (fs.existsSync(pathA)) { } else if (fs.existsSync(pathD)) { workerSourcePath = pathD; console.log("Found sqlite.worker.js at (Strategy D - processedResources):", pathD); +} else if (fs.existsSync(pathE)) { + workerSourcePath = pathE; + console.log("Found sqlite.worker.js at (Strategy E - build dir relative):", pathE); +} else if (fs.existsSync(pathF)) { + workerSourcePath = pathF; + console.log("Found sqlite.worker.js at (Strategy F - build dir processedResources):", pathF); +} else if (fs.existsSync(pathG)) { + workerSourcePath = pathG; + console.log("Found sqlite.worker.js at (Strategy G - cwd project root):", pathG); +} else if (fs.existsSync(pathH)) { + workerSourcePath = pathH; + console.log("Found sqlite.worker.js at (Strategy H - cwd project root processedResources):", pathH); } else { console.error("ERROR: Could not find sqlite.worker.js in any expected location!"); console.error("Checked A:", pathA); console.error("Checked B:", pathB); console.error("Checked C:", pathC); console.error("Checked D:", pathD); + console.error("Checked E:", pathE); + console.error("Checked F:", pathF); + console.error("Checked G:", pathG); + console.error("Checked H:", pathH); } if (workerSourcePath) {