Skip to content

fix(db): preserve runtime driver require in webpack standalone bundles - #10552

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.50from
excessivechaos:fix/db-driver-runtime-require
Aug 18, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.50from
excessivechaos:fix/db-driver-runtime-require

Conversation

@excessivechaos

@excessivechaos excessivechaos commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Problem\nNext.js webpack standalone builds can rewrite dynamic createRequire(import.meta.url) calls so native SQLite drivers fail to resolve. The driver cascade then silently falls back to sql.js, whose whole-file persistence can expose a torn database after a crash.\n\n## Fix\n- Use a small runtime loader: eval("require") inside CommonJS webpack chunks, with createRequire(import.meta.url) fallback for ESM dev/tests.\n- Route the DB driver callers through that loader.\n- Persist sql.js exports through a temp file followed by renameSync.\n- Add a runtime-loader regression test.\n\n## Verification\n- Focused driverFactory and sqljsAdapter tests: 27 passed.\n- Changed-file ESLint: passed.\n- Live Windows standalone verification: native WAL regenerated, ping healthy, and no new database-malformed errors after restart.\n\nThe direct-egress/Crof timeout fix is separate (#10528).

@excessivechaos
excessivechaos force-pushed the fix/db-driver-runtime-require branch from d5843e7 to 4a9d327 Compare August 16, 2026 19:22
@excessivechaos excessivechaos changed the title fix(db): anchor runtime driver requires at process entry; atomic sql.js persist fix(db): preserve runtime driver require in webpack standalone bundles Aug 16, 2026
@diegosouzapw
diegosouzapw changed the base branch from main to release/v3.8.50 August 17, 2026 05:34
@diegosouzapw

Copy link
Copy Markdown
Owner

The PR has been retargeted and verified against release/v3.8.50. It still needs an in-place replacement for the eval("require") loader, which violates the repository no-eval rule, followed by standalone-artifact validation. It remains out of the train until that fix lands.

@excessivechaos
excessivechaos force-pushed the fix/db-driver-runtime-require branch 3 times, most recently from c7ceaa5 to fa6eccd Compare August 17, 2026 15:49
@excessivechaos
excessivechaos force-pushed the fix/db-driver-runtime-require branch from fa6eccd to 98b7240 Compare August 17, 2026 16:10
@diegosouzapw
diegosouzapw merged commit 0431dd8 into diegosouzapw:release/v3.8.50 Aug 18, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants