fix: openclaw module loading (#993)

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Haze <hazeone@users.noreply.github.com>
This commit is contained in:
Haze
2026-05-08 15:36:39 +08:00
committed by GitHub
parent c6adf36b57
commit 15e8fe8e05
4 changed files with 240 additions and 3 deletions

View File

@@ -18,6 +18,7 @@
import 'zx/globals';
import { EXTRA_BUNDLED_PACKAGES } from './openclaw-bundle-config.mjs';
import { patchExtensionOpenClawSelfImports } from './openclaw-self-import-patch.mjs';
const ROOT = path.resolve(__dirname, '..');
const OUTPUT = path.join(ROOT, 'build', 'openclaw');
@@ -973,6 +974,11 @@ function patchBundledRuntime(outputDir) {
patchBrokenModules(outputNodeModules);
patchBundledRuntime(OUTPUT);
const openclawSelfImportPatch = patchExtensionOpenClawSelfImports(OUTPUT);
if (openclawSelfImportPatch.specifiersPatched > 0) {
echo` 🩹 Rewrote ${openclawSelfImportPatch.specifiersPatched} OpenClaw plugin-sdk self-import(s) in ${openclawSelfImportPatch.filesPatched} extension file(s)`;
}
// 8. Verify the bundle
const entryExists = fs.existsSync(path.join(OUTPUT, 'openclaw.mjs'));
const distExists = fs.existsSync(path.join(OUTPUT, 'dist', 'entry.js'));