-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
53 lines (48 loc) · 1.76 KB
/
next.config.js
File metadata and controls
53 lines (48 loc) · 1.76 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
53
const path = require("path");
const webpack = require("next/dist/compiled/webpack/webpack-lib");
/** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: [
"@shadergradient/react",
"@react-three/fiber",
"three",
"three-stdlib",
],
experimental: {
serverComponentsExternalPackages: ["@composio/core"],
},
webpack: (config, { isServer }) => {
config.resolve.alias = {
...config.resolve.alias,
"@shadergradient/react": path.resolve(
__dirname,
"node_modules/@shadergradient/react/dist/index.mjs"
),
};
// Fix: recharts imports es-toolkit/compat/<fn> which Next.js 14 can't resolve
// via package exports subpaths. Redirect to the bundled compat module.
if (!isServer) {
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(
/^es-toolkit\/compat\/.+$/,
(resource) => {
// e.g. "es-toolkit/compat/get" → require the function from the compat bundle
const fnName = resource.request.split("/").pop();
resource.request = path.resolve(
__dirname,
"node_modules/es-toolkit/compat",
fnName + ".js"
);
}
)
);
// Stub out fs for @vercel/oidc (pulled in by @ai-sdk/gateway via ai via @ai-sdk/react)
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
};
}
return config;
},
};
module.exports = nextConfig;