fix(db): preserve runtime driver require in webpack standalone bundles - #10552
Merged
diegosouzapw merged 1 commit intoAug 18, 2026
Conversation
excessivechaos
force-pushed
the
fix/db-driver-runtime-require
branch
from
August 16, 2026 19:22
d5843e7 to
4a9d327
Compare
Owner
|
The PR has been retargeted and verified against |
excessivechaos
force-pushed
the
fix/db-driver-runtime-require
branch
3 times, most recently
from
August 17, 2026 15:49
c7ceaa5 to
fa6eccd
Compare
excessivechaos
force-pushed
the
fix/db-driver-runtime-require
branch
from
August 17, 2026 16:10
fa6eccd to
98b7240
Compare
5 tasks done
HouMinXi
pushed a commit
to HouMinXi/OmniRoute
that referenced
this pull request
Aug 20, 2026
giauphan
pushed a commit
to giauphan/OmniRoute
that referenced
this pull request
Aug 20, 2026
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).