From 1309cdf8607a60f88fc01997c47e038fffd5fb66 Mon Sep 17 00:00:00 2001 From: elrrrrrrr Date: Mon, 22 Jun 2026 20:16:58 +0800 Subject: [PATCH] fix(dal-gen): await async loader.load() for egg4 compatibility In egg4 the tegg loader's `load()` is async and returns a Promise, but `lib/dal-gen.js` consumed it synchronously, so `for (const clazz of clazzList)` threw `TypeError: clazzList is not iterable` during `egg-bin generate dal code`. (`@eggjs/dal-runtime`'s own DaoLoader already awaits it.) Await the loader. Co-Authored-By: Claude Opus 4.8 (1M context) --- lib/dal-gen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dal-gen.js b/lib/dal-gen.js index b44df006..9a73f0b8 100644 --- a/lib/dal-gen.js +++ b/lib/dal-gen.js @@ -23,7 +23,7 @@ const teggDalPkgName = process.argv[5]; dalPkg: teggDalPkgName, }); const loader = LoaderFactory.createLoader(moduleDir, 'MODULE'); - const clazzList = loader.load(); + const clazzList = await loader.load(); for (const clazz of clazzList) { if (TableInfoUtil.getIsTable(clazz)) { const tableModel = TableModel.build(clazz);