From a0e6f57d9bd085165706168f35a40b3a9b7a5219 Mon Sep 17 00:00:00 2001
From: Gunnar Holwerda <gunnarholwerda@gmail.com>
Date: Mon, 9 Dec 2024 19:51:52 -0800
Subject: [PATCH] Pass options through to userWebpack in withLlamaIndex (#1550)

---
 .changeset/weak-cats-smash.md   | 5 +++++
 packages/llamaindex/src/next.ts | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
 create mode 100644 .changeset/weak-cats-smash.md

diff --git a/.changeset/weak-cats-smash.md b/.changeset/weak-cats-smash.md
new file mode 100644
index 000000000..62246011d
--- /dev/null
+++ b/.changeset/weak-cats-smash.md
@@ -0,0 +1,5 @@
+---
+"llamaindex": patch
+---
+
+withLlamaIndex now passes through webpack options to the passed in customized NextJS webpack config. Before it was only passing through the config.
diff --git a/packages/llamaindex/src/next.ts b/packages/llamaindex/src/next.ts
index e27b52458..fb8f44527 100644
--- a/packages/llamaindex/src/next.ts
+++ b/packages/llamaindex/src/next.ts
@@ -41,7 +41,7 @@ export default function withLlamaIndex(config: any) {
   // eslint-disable-next-line @typescript-eslint/no-explicit-any
   config.webpack = function (webpackConfig: any, options: any) {
     if (userWebpack) {
-      webpackConfig = userWebpack(webpackConfig);
+      webpackConfig = userWebpack(webpackConfig, options);
     }
     webpackConfig.resolve.alias = {
       ...webpackConfig.resolve.alias,
-- 
GitLab