fix: externalize better-sqlite3 for Next.js standalone builds

Move better-sqlite3 to optionalDependencies so npm install doesn't
fail on platforms without native build tools. Add it to
serverExternalPackages so Next.js doesn't try to bundle the native
addon into webpack chunks.

Fixes #243
Fixes #184

Thanks @East-rayyy for the contribution! Sorry for the delay in reviewing.

Co-authored-by: Ibrahim Ryan <ryan@nuevanext.com>
Made-with: Cursor
This commit is contained in:
decolua
2026-03-23 10:22:17 +07:00
2 changed files with 4 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
output: "standalone", output: "standalone",
serverExternalPackages: ["better-sqlite3"],
images: { images: {
unoptimized: true unoptimized: true
}, },

View File

@@ -38,6 +38,9 @@
"uuid": "^13.0.0", "uuid": "^13.0.0",
"zustand": "^5.0.10" "zustand": "^5.0.10"
}, },
"optionalDependencies": {
"better-sqlite3": "^12.6.2"
},
"devDependencies": { "devDependencies": {
"@tailwindcss/postcss": "^4.1.18", "@tailwindcss/postcss": "^4.1.18",
"eslint": "^9", "eslint": "^9",