@@ -46,6 +46,10 @@ const isDev = process.env.NODE_ENV === 'development';
4646const isDeployPreview =
4747 ! ! process . env . NETLIFY && process . env . CONTEXT === 'deploy-preview' ;
4848
49+ // Netlify branch deploy like "docusaurus-v2"
50+ const isBranchDeploy =
51+ ! ! process . env . NETLIFY && process . env . CONTEXT === 'branch-deploy' ;
52+
4953// Used to debug production build issues faster
5054const isBuildFast = ! ! process . env . BUILD_FAST ;
5155
@@ -82,15 +86,16 @@ const config = {
8286 ] ,
8387 i18n : {
8488 defaultLocale : 'en' ,
85- // eslint-disable-next-line no-nested-ternary
86- locales : isDeployPreview
87- ? // Deploy preview: keep it fast!
88- [ 'en' ]
89- : isI18nStaging
90- ? // Staging locales: https://docusaurus-i18n-staging.netlify.app/
91- [ 'en' , 'ja' ]
92- : // Production locales
93- [ 'en' , 'fr' , 'pt-BR' , 'ko' , 'zh-CN' ] ,
89+
90+ locales :
91+ isDeployPreview || isBranchDeploy
92+ ? // Deploy preview and branch deploys: keep them fast!
93+ [ 'en' ]
94+ : isI18nStaging
95+ ? // Staging locales: https://docusaurus-i18n-staging.netlify.app/
96+ [ 'en' , 'ja' ]
97+ : // Production locales
98+ [ 'en' , 'fr' , 'pt-BR' , 'ko' , 'zh-CN' ] ,
9499 } ,
95100 webpack : {
96101 jsLoader : ( isServer ) => ( {
@@ -299,11 +304,15 @@ const config = {
299304 remarkPlugins : [ math , [ npm2yarn , { sync : true } ] ] ,
300305 rehypePlugins : [ ] ,
301306 disableVersioning : isVersioningDisabled ,
302- lastVersion : isDev || isDeployPreview ? 'current' : undefined ,
307+ lastVersion :
308+ isDev || isDeployPreview || isBranchDeploy ? 'current' : undefined ,
303309 onlyIncludeVersions : ( ( ) => {
304310 if ( isBuildFast ) {
305311 return [ 'current' ] ;
306- } else if ( ! isVersioningDisabled && ( isDev || isDeployPreview ) ) {
312+ } else if (
313+ ! isVersioningDisabled &&
314+ ( isDev || isDeployPreview || isBranchDeploy )
315+ ) {
307316 return [ 'current' , ...versions . slice ( 0 , 2 ) ] ;
308317 }
309318 return undefined ;
@@ -341,7 +350,7 @@ const config = {
341350 './_dogfooding/dogfooding.css' ,
342351 ] ,
343352 } ,
344- gtag : ! isDeployPreview
353+ gtag : ! ( isDeployPreview || isBranchDeploy )
345354 ? {
346355 trackingID : 'UA-141789564-1' ,
347356 }
0 commit comments