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): keep esbuild external in the electron main bundle

esengineb9e4211fb0a0
diff --git a/desktop/vite.config.ts b/desktop/vite.config.ts
index d83773656..033316b5c 100644
--- a/desktop/vite.config.ts
+++ b/desktop/vite.config.ts
@@ -29,6 +29,12 @@ export default defineConfig({
electron({
main: {
entry: 'electron/main.ts',
+ // esbuild ships a native binary it locates via __dirname; bundling it into
+ // the ESM main breaks that (`filename is not defined` when buildScripts /
+ // exportGame run it). Keep it external → required from node_modules at
+ // runtime where its binary resolution works. (Vite 8 = Rolldown, so the
+ // option is `rolldownOptions`, not `rollupOptions`.)
+ vite: { build: { rolldownOptions: { external: ['esbuild'] } } },
},
preload: {
input: 'electron/preload.ts',