feat(v2): enable user to analyze production bundle size (#1334)

* feat(v2): enable user to analyze bundle size with --bundle-analyzer for production

* nits
This commit is contained in:
Endilie Yacop Sucipto 2019-04-04 00:42:11 +07:00 committed by Yangshun Tay
parent 5db02f41a9
commit c129c68d1c
8 changed files with 79 additions and 19 deletions

View file

@ -238,11 +238,9 @@ describe('loadDocs', () => {
{
path: '../docs',
sidebarPath,
skipNextRelease: true,
},
{
cliOptions: {
skipNextRelease: true,
},
env,
siteDir,
siteConfig,

View file

@ -25,6 +25,7 @@ const DEFAULT_OPTIONS = {
// TODO: Settle themeing.
docLayoutComponent: '@theme/Doc',
docItemComponent: '@theme/DocBody',
skipNextRelease: false, // Skip documents from next release (default = false)
};
class DocusaurusPluginContentDocs {
@ -44,9 +45,8 @@ class DocusaurusPluginContentDocs {
// Fetches blog contents and returns metadata for the contents.
async loadContent() {
const {include, routeBasePath, sidebarPath} = this.options;
const {siteDir, env, siteConfig, cliOptions = {}} = this.context;
const {skipNextRelease} = cliOptions;
const {include, routeBasePath, sidebarPath, skipNextRelease} = this.options;
const {siteDir, env, siteConfig} = this.context;
const docsDir = this.contentPath;
// We don't want sidebars to be cached because of hotreloading.