Skip to content

Commit

Permalink
fix: avoid using spread for client code
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Sep 1, 2021
1 parent 034c737 commit 03abee7
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/shared/shared.ts
Expand Up @@ -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)
}
})
}

/**
Expand Down

0 comments on commit 03abee7

Please sign in to comment.