From 5e61a16815310e0b5d07a16b7881e04447da2c44 Mon Sep 17 00:00:00 2001 From: Siddharth Suresh Date: Wed, 17 Apr 2024 19:34:19 +0530 Subject: [PATCH] bug: merge existing and blitz turbo config (#4323) * do not oveeride existing config * Create calm-deers-sin.md * Update packages/blitz-next/src/index-server.ts --- .changeset/calm-deers-sin.md | 6 ++++++ packages/blitz-next/src/index-server.ts | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .changeset/calm-deers-sin.md diff --git a/.changeset/calm-deers-sin.md b/.changeset/calm-deers-sin.md new file mode 100644 index 0000000000..0244ef51a7 --- /dev/null +++ b/.changeset/calm-deers-sin.md @@ -0,0 +1,6 @@ +--- +"@blitzjs/next": patch +"blitz": patch +--- + +bug: merge existing and custom blitz turbo configs diff --git a/packages/blitz-next/src/index-server.ts b/packages/blitz-next/src/index-server.ts index d1cf9a0926..123e4ba27d 100644 --- a/packages/blitz-next/src/index-server.ts +++ b/packages/blitz-next/src/index-server.ts @@ -306,8 +306,22 @@ export function withBlitz(nextConfig: BlitzConfig = {}): NextConfig { }) if (process.env.TURBOPACK) { - ;(config as any).experimental = { - turbo: installTurboConfig(), + const blitzTurboConfig = installTurboConfig() + config.experimental = { + ...config.experimental, + turbo: { + loaders: { + ...config.experimental?.turbo?.loaders, + }, + resolveAlias: { + ...config.experimental?.turbo?.resolveAlias, + ...blitzTurboConfig.resolveAlias, + }, + rules: { + ...config.experimental?.turbo?.rules, + ...blitzTurboConfig.rules, + }, + }, } }