diff --git a/next.config.mjs b/next.config.mjs index e13d80c0d..3fd18c7c3 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -6,8 +6,6 @@ console.log("[Next] build mode", mode); const disableChunk = !!process.env.DISABLE_CHUNK || mode === "export"; console.log("[Next] build with chunk: ", !disableChunk); -process.env.LANGCHAIN_CALLBACKS_BACKGROUND = true; - /** @type {import('next').NextConfig} */ const nextConfig = { webpack(config) { @@ -22,6 +20,12 @@ const nextConfig = { ); } + config.plugins.push( + new webpack.DefinePlugin({ + 'process.env.LANGCHAIN_CALLBACKS_BACKGROUND': JSON.stringify('true'), + }) + ); + config.resolve.fallback = { child_process: false, }; @@ -104,4 +108,4 @@ if (mode !== "export") { }; } -export default nextConfig; +export default nextConfig; \ No newline at end of file