fix(bundler): fix docusaurus start using concatenateModules: true (#11222)

This commit is contained in:
Sébastien Lorber 2025-05-30 21:07:11 +02:00 committed by GitHub
parent 1c454a9430
commit ffa7525ff9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 7 deletions

View file

@ -253,13 +253,6 @@ export async function createBaseConfig({
modules: ['node_modules', path.join(siteDir, 'node_modules')],
},
optimization: {
// The optimization.concatenateModules is expensive
// - On the server, it's not useful to run it at all
// - On the client, it leads to a ~3% JS assets total size decrease
// Let's keep it by default, but large sites may prefer faster builds
// See also https://github.com/facebook/docusaurus/pull/11176
concatenateModules: !isServer,
// The optimization.mergeDuplicateChunks is expensive
// - On the server, it's not useful to run it at all
// - On the client, we compared assets/js before/after and see 0 change

View file

@ -52,6 +52,16 @@ export default async function createServerConfig({
color: 'yellow',
}),
],
optimization: {
// The optimization.concatenateModules is expensive
// - On the server, it's not useful to run it at all
// - On the client, it leads to a ~3% JS assets total size decrease
// Let's keep it by default, but large sites may prefer faster builds
// See also https://github.com/facebook/docusaurus/pull/11176
// Note: we don't want to enable it on the client for "docusaurus start"
// See also https://github.com/facebook/docusaurus/pull/11222
concatenateModules: false,
},
});
return {config, serverBundlePath};