-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Expand file tree
/
Copy pathnext.config.js
More file actions
52 lines (47 loc) · 1.61 KB
/
next.config.js
File metadata and controls
52 lines (47 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { createRequire } from "node:module";
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
const require = createRequire(import.meta.url);
const distDir = process.env.NEXT_DIST_DIR;
/** @type {import('next').NextConfig} */
const nextConfig = {
...(distDir ? { distDir } : {}),
outputFileTracingRoot: __dirname,
transpilePackages: ["@electric-sql/pglite-react"],
// Exclude PGLite from server-side bundling to preserve file paths for extensions
serverExternalPackages: [
"@electric-sql/pglite",
"@elizaos/core",
"@elizaos/plugin-openai",
"@elizaos/plugin-sql",
"zlib-sync",
],
webpack: (config, { isServer }) => {
if (isServer) {
config.resolve = config.resolve ?? {};
config.resolve.alias = {
...config.resolve.alias,
"zlib-sync": require.resolve("zlib-sync"),
};
config.ignoreWarnings = [
...(config.ignoreWarnings || []),
{
module: /core[/\\]dist[/\\]node[/\\]index\.node\.js/,
message: /Critical dependency/,
},
];
// Don't bundle PGLite extension files as assets
config.externals = config.externals || [];
config.externals.push({
"@electric-sql/pglite": "commonjs @electric-sql/pglite",
"@electric-sql/pglite/vector": "commonjs @electric-sql/pglite/vector",
"@electric-sql/pglite/contrib/fuzzystrmatch":
"commonjs @electric-sql/pglite/contrib/fuzzystrmatch",
"zlib-sync": "commonjs zlib-sync",
});
}
return config;
},
};
export default nextConfig;