diff --git a/next.config.mjs b/next.config.mjs index 2f06962ee2..aefe08fadd 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -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: { diff --git a/tests/unit/next-config.test.ts b/tests/unit/next-config.test.ts index 4a523e50b2..11ec9ed4bb 100644 --- a/tests/unit/next-config.test.ts +++ b/tests/unit/next-config.test.ts @@ -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/**/*"));