@@ -34,6 +34,8 @@ export type BuildLocaleParams = {
3434 cliOptions : Partial < BuildCLIOptions > ;
3535} ;
3636
37+ const SkipBundling = process . env . DOCUSAURUS_SKIP_BUNDLING === 'true' ;
38+
3739export async function buildLocale ( {
3840 siteDir,
3941 locale,
@@ -82,19 +84,25 @@ export async function buildLocale({
8284 // We also clear website/build dir
8385 // returns void, no useful result needed before compilation
8486 // See also https://github.com/facebook/docusaurus/pull/11037
85- clearPath ( outDir ) ,
87+ SkipBundling ? undefined : clearPath ( outDir ) ,
8688 ] ) ,
8789 ) ;
8890
89- // Run webpack to build JS bundle (client) and static html files (server).
90- await PerfLogger . async ( `Bundling with ${ props . currentBundler . name } ` , ( ) => {
91- return compile ( {
92- configs :
93- // For hash router we don't do SSG and can skip the server bundle
94- router === 'hash' ? [ clientConfig ] : [ clientConfig , serverConfig ] ,
95- currentBundler : configureWebpackUtils . currentBundler ,
91+ if ( SkipBundling ) {
92+ console . warn (
93+ `Skipping the Docusaurus bundling step because DOCUSAURUS_SKIP_BUNDLING='true'` ,
94+ ) ;
95+ } else {
96+ // Run webpack to build JS bundle (client) and static html files (server).
97+ await PerfLogger . async ( `Bundling with ${ props . currentBundler . name } ` , ( ) => {
98+ return compile ( {
99+ configs :
100+ // For hash router we don't do SSG and can skip the server bundle
101+ router === 'hash' ? [ clientConfig ] : [ clientConfig , serverConfig ] ,
102+ currentBundler : configureWebpackUtils . currentBundler ,
103+ } ) ;
96104 } ) ;
97- } ) ;
105+ }
98106
99107 const { collectedData} = await PerfLogger . async ( 'SSG' , ( ) =>
100108 executeSSG ( {
@@ -231,7 +239,7 @@ async function getBuildServerConfig({
231239async function cleanupServerBundle ( serverBundlePath : string ) {
232240 if ( process . env . DOCUSAURUS_KEEP_SERVER_BUNDLE === 'true' ) {
233241 logger . warn (
234- "Will NOT delete server bundle because DOCUSAURUS_KEEP_SERVER_BUNDLE is set to 'true'" ,
242+ "Will NOT delete server bundle because DOCUSAURUS_KEEP_SERVER_BUNDLE= 'true'" ,
235243 ) ;
236244 } else {
237245 await PerfLogger . async ( 'Deleting server bundle' , async ( ) => {
0 commit comments