fix(build): trace-include sql.js sql-wasm.wasm in standalone bundle (#4839)

Integrated into release/v3.8.37 — cherry-picked defining commit onto release tip; CHANGELOG re-merged; tests green.
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-06-25 23:32:34 -03:00
committed by GitHub
parent 12a621c1f3
commit 604e0041bd
2 changed files with 11 additions and 0 deletions

View File

@@ -146,6 +146,10 @@ const nextConfig = {
"./open-sse/services/compression/rules/**/*.json",
"./open-sse/lib/sha3_wasm_bg.wasm",
"./open-sse/lib/deepseek-pow-solver.cjs",
// sql.js WASM is loaded at runtime by the sqljsAdapter fallback tier
// (better-sqlite3 → node:sqlite → sql.js). Next traces sql-wasm.js but can
// omit the runtime sql-wasm.wasm asset from the standalone bundle.
"./node_modules/sql.js/dist/sql-wasm.wasm",
],
},
outputFileTracingExcludes: {

View File

@@ -77,6 +77,13 @@ test("next config declares Turbopack aliases, runtime assets and server external
tracingIncludes.includes("./open-sse/services/compression/engines/rtk/filters/**/*.json")
);
assert.ok(tracingIncludes.includes("./open-sse/services/compression/rules/**/*.json"));
// sql.js WASM must ship in the standalone bundle: sqljsAdapter resolves it from
// node_modules/sql.js/dist/sql-wasm.wasm at runtime (driver fallback tier), but
// Next traces sql-wasm.js without auto-including the runtime .wasm asset.
assert.ok(
tracingIncludes.includes("./node_modules/sql.js/dist/sql-wasm.wasm"),
"sql-wasm.wasm must be trace-included so the sql.js fallback works in standalone builds"
);
assert.ok(tracingExcludes.includes("./_tasks/**/*"));
assert.ok(tracingExcludes.includes("./tests/**/*"));