Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(editor): every starter carries the module the editor reads schemas from

yhh20de764647af
diff --git a/desktop/templates/playable-ad/src/components.ts b/desktop/templates/playable-ad/src/components.ts
new file mode 100644
index 000000000..fee09de68
--- /dev/null
+++ b/desktop/templates/playable-ad/src/components.ts
@@ -0,0 +1,3 @@
+// Declare your components here with defineComponent / defineTag. The editor
+// imports only this module to read component schemas — keep startup code out.
+export {};
diff --git a/desktop/templates/wechat-minigame/src/components.ts b/desktop/templates/wechat-minigame/src/components.ts
new file mode 100644
index 000000000..fee09de68
--- /dev/null
+++ b/desktop/templates/wechat-minigame/src/components.ts
@@ -0,0 +1,3 @@
+// Declare your components here with defineComponent / defineTag. The editor
+// imports only this module to read component schemas — keep startup code out.
+export {};
diff --git a/desktop/tests/templates.test.ts b/desktop/tests/templates.test.ts
index 9cf74156c..0fcfc79bf 100644
--- a/desktop/tests/templates.test.ts
+++ b/desktop/tests/templates.test.ts
@@ -34,9 +34,9 @@ describe('bundled starter templates', () => {
const scenePath = path.join(dir, manifest.defaultScene!);
expect(existsSync(scenePath)).toBe(true);
const scene = JSON.parse(readFileSync(scenePath, 'utf8')) as {
- entities: Array<{ components: Array<{ type: string; data?: Record<string, unknown> }> }>;
+ entities: Array<{ components?: Array<{ type: string; data?: Record<string, unknown> }> }>;
};
- const cameras = scene.entities.flatMap((e) => e.components).filter((c) => c.type === 'Camera');
+ const cameras = scene.entities.flatMap((e) => e.components ?? []).filter((c) => c.type === 'Camera');
expect(cameras.some((c) => c.data?.isActive === true)).toBe(true);
// Script entry points (schema extraction + play-realm bundle entry).