fix(web): externalize ao-core and better-sqlite3 from Next.js bundle
Fixes #1930. Next.js bundles @aoagents/ao-core (via transpilePackages) and bakes import.meta.url as the build machine's absolute path into the output. At runtime on any other machine (especially Windows), createRequire() receives a non-existent file:// URL and fails. Adding @aoagents/ao-core and better-sqlite3 to serverExternalPackages tells Next.js to not bundle these — they're resolved at runtime from node_modules, so import.meta.url resolves to the actual install path. This fixes: - events-db.ts: createRequire(import.meta.url)("better-sqlite3") - update-cache.ts: createRequire(fileURLToPath(import.meta.url)) - The Windows ERR_INVALID_ARG_VALUE error in the user report
This commit is contained in:
parent
45de80ce3f
commit
eec8ffe2ad
|
|
@ -22,6 +22,8 @@ const nextConfig = {
|
|||
serverExternalPackages: [
|
||||
"yaml",
|
||||
"zod",
|
||||
"@aoagents/ao-core",
|
||||
"better-sqlite3",
|
||||
],
|
||||
webpack: (config, { isServer }) => {
|
||||
if (process.platform === "win32") {
|
||||
|
|
|
|||
Loading…
Reference in New Issue