From 425e0648efa6228d5547c552b60967ccba62f05c Mon Sep 17 00:00:00 2001 From: Aiji Uejima Date: Wed, 18 Aug 2021 22:33:59 +0900 Subject: [PATCH] feat: collaborate with Spectrum --- src/with-split.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/with-split.ts b/src/with-split.ts index 89396a5..de910ef 100644 --- a/src/with-split.ts +++ b/src/with-split.ts @@ -13,10 +13,16 @@ type WithSplitArgs = { } export const withSplit = - ({ splits = {}, ...manuals }: WithSplitArgs) => + ({ splits: _splits = {}, ...manuals }: WithSplitArgs) => (nextConfig: Partial): Partial => { if (process.env.SPLIT_DISABLE) return nextConfig + // Load the configuration using Spectrum. + const splits: SplitOptions = + Object.keys(_splits).length > 0 + ? _splits + : JSON.parse(process.env.SPLIT_CONFIG_BY_SPECTRUM ?? '{}') + const isMain = !!process.env.SPLIT_ACTIVE || (manuals?.isOriginal ?? process.env.VERCEL_ENV === 'production')