From 5aaa33fc6192dbe26ca3a52e8eab88ff10cea621 Mon Sep 17 00:00:00 2001 From: Lane Goolsby Date: Thu, 19 May 2022 21:50:17 -0700 Subject: [PATCH] feat: add --no-minify flag to docusaurus start (#7452) * feat: Adding --no-minify flag to start * Undoing the changes to old docs Co-authored-by: Lane Goolsby --- packages/docusaurus/bin/docusaurus.mjs | 4 ++ packages/docusaurus/src/commands/start.ts | 54 ++++++++++++----------- website/docs/cli.md | 1 + 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/packages/docusaurus/bin/docusaurus.mjs b/packages/docusaurus/bin/docusaurus.mjs index ec6a5cfffb88..820d26e7de9a 100755 --- a/packages/docusaurus/bin/docusaurus.mjs +++ b/packages/docusaurus/bin/docusaurus.mjs @@ -126,6 +126,10 @@ cli '--poll [interval]', 'use polling rather than watching for reload (default: false). Can specify a poll interval in milliseconds', ) + .option( + '--no-minify', + 'build website without minimizing JS bundles (default: false)', + ) .action(async (siteDir, options) => start(await resolveDir(siteDir), options), ); diff --git a/packages/docusaurus/src/commands/start.ts b/packages/docusaurus/src/commands/start.ts index 551bca65cc0e..a9e4e1e11e39 100644 --- a/packages/docusaurus/src/commands/start.ts +++ b/packages/docusaurus/src/commands/start.ts @@ -32,6 +32,7 @@ export type StartCLIOptions = HostPortOptions & hotOnly?: boolean; open?: boolean; poll?: boolean | number; + minify?: boolean; }; export async function start( @@ -121,32 +122,35 @@ export async function start( fsWatcher.on(event, reload), ); - let config: webpack.Configuration = merge(await createClientConfig(props), { - watchOptions: { - ignored: /node_modules\/(?!@docusaurus)/, - poll: cliOptions.poll, - }, - infrastructureLogging: { - // Reduce log verbosity, see https://github.com/facebook/docusaurus/pull/5420#issuecomment-906613105 - level: 'warn', + let config: webpack.Configuration = merge( + await createClientConfig(props, cliOptions.minify), + { + watchOptions: { + ignored: /node_modules\/(?!@docusaurus)/, + poll: cliOptions.poll, + }, + infrastructureLogging: { + // Reduce log verbosity, see https://github.com/facebook/docusaurus/pull/5420#issuecomment-906613105 + level: 'warn', + }, + plugins: [ + // Generates an `index.html` file with the