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.

chore(native): the bundle embed's note fits the comment budget

esengine3053845bcbba
diff --git a/build-tools/tasks/native.js b/build-tools/tasks/native.js
index e893d5eed..58dc2678b 100644
--- a/build-tools/tasks/native.js
+++ b/build-tools/tasks/native.js
@@ -128,10 +128,9 @@ async function generateSdkBundle(rootDir, genDir) {
// out as a file too, because the bytecode step must compile these exact bytes
// for the host to accept the result (see precompileBundleBytecode).
const embedded = '\n' + js;
- // A BYTE ARRAY, not a string literal: MSVC caps a literal at 65535 bytes and
- // counts the concatenated result too, so for an ~800 KB bundle neither one
- // literal nor many works. NUL-terminated for QuickJS, which wants that byte
- // past the end — but measured by its size: JS may hold a NUL of its own.
+ // A BYTE ARRAY: MSVC caps a string literal (and a concatenation) at 65535 bytes.
+ // NUL-terminated because QuickJS wants that byte past the end, but measured by
+ // its size, since JS may hold a NUL of its own.
const bytes = Buffer.from(embedded, 'utf8');
const rows = [];
for (let at = 0; at < bytes.length; at += 32) {