-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
60 lines (56 loc) · 2.02 KB
/
next.config.js
File metadata and controls
60 lines (56 loc) · 2.02 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
54
55
56
57
58
59
60
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
serverActions: {
bodySizeLimit: '10mb',
},
/**
* NEXT.JS BUNDLING WORKAROUND for LaunchDarkly AI SDK
*
* The LaunchDarkly AI SDK uses dynamic imports to load provider-specific packages
* only when needed (e.g., import('@launchdarkly/server-sdk-ai-openai')).
*
* Next.js statically analyzes these imports at build time and tries to bundle them,
* even though they're optional and we don't have them installed.
*
* This configuration tells Next.js to treat these packages as external Node.js
* modules that should NOT be bundled into the application.
*
* This affects: Local dev, Docker builds, and Vercel deployments
*/
serverComponentsExternalPackages: [
'@launchdarkly/node-server-sdk',
'@launchdarkly/server-sdk-ai',
'@launchdarkly/server-sdk-ai-vercel',
],
},
webpack: (config, { isServer }) => {
if (isServer) {
/**
* Tell webpack to ignore these optional LaunchDarkly provider packages
* that we don't have installed. The SDK tries to dynamically import these
* based on the provider configuration, but we're using the Vercel provider
* directly with @ai-sdk packages instead.
*
* Setting these to 'false' tells webpack: "Don't try to resolve these modules"
*/
config.resolve.alias = {
...config.resolve.alias,
'@launchdarkly/server-sdk-ai-openai': false,
'@launchdarkly/server-sdk-ai-anthropic': false,
'@launchdarkly/server-sdk-ai-bedrock': false,
'@launchdarkly/server-sdk-ai-langchain': false,
};
}
// Suppress "Module not found" warnings for these optional dependencies
// in the build output to keep the console clean
config.ignoreWarnings = [
{
module: /@launchdarkly\/server-sdk-ai/,
message: /Module not found.*@launchdarkly\/server-sdk-ai-/,
},
];
return config;
},
}
module.exports = nextConfig