From 03abee7f7c0fac95806f31ff5761b9e912a1f232 Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 1 Sep 2021 12:47:59 -0400 Subject: [PATCH] fix: avoid using spread for client code --- src/shared/shared.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/shared/shared.ts b/src/shared/shared.ts index f42a0f96600..d3d34eb8c39 100644 --- a/src/shared/shared.ts +++ b/src/shared/shared.ts @@ -66,20 +66,18 @@ export function resolveSiteDataByRoute( route ) - return { - ...siteData, - ...localeData, - themeConfig: { - ...siteData.themeConfig, - ...localeThemeConfig, + // avoid object rest spread since this is going to run in the browser + // and spread is going to result in polyfill code + return Object.assign({}, siteData, localeData, { + themeConfig: Object.assign({}, siteData.themeConfig, localeThemeConfig, { // clean the locales to reduce the bundle size locales: {} - }, + }), lang: (localeData || siteData).lang, // clean the locales to reduce the bundle size locales: {}, langs: createLangDictionary(siteData) - } + }) } /**