Skip to content

Commit b1b7e48

Browse files
committed
add disableExpensiveBundlerOptimizationPlugin
1 parent d56b594 commit b1b7e48

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

website/docusaurus.config.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ import path from 'path';
1313
import users from './showcase.json';
1414
import versions from './versions.json';
1515

16+
// See https://docs.netlify.com/configure-builds/environment-variables/
17+
const isProductionDeployment =
18+
!!process.env.NETLIFY && process.env.CONTEXT === 'production';
19+
1620
const lastVersion = versions[0];
1721
const copyright = `Copyright © ${new Date().getFullYear()} Meta Platforms, Inc.`;
1822

@@ -156,6 +160,21 @@ const config: Config = {
156160
],
157161
plugins: [
158162
'docusaurus-plugin-sass',
163+
function disableExpensiveBundlerOptimizationPlugin() {
164+
return {
165+
name: 'disable-expensive-bundler-optimizations',
166+
configureWebpack(_config, isServer) {
167+
// This optimization is expensive and only reduces by 3% the JS assets size
168+
// Let's skip it for local and deploy preview builds
169+
// See also https://github.com/facebook/docusaurus/pull/11176
170+
return {
171+
optimization: {
172+
concatenateModules: isProductionDeployment ? !isServer : false,
173+
},
174+
};
175+
},
176+
};
177+
},
159178
[
160179
'content-docs',
161180
{

0 commit comments

Comments
 (0)