diff --git a/dev-packages/rollup-utils/bundleHelpers.mjs b/dev-packages/rollup-utils/bundleHelpers.mjs index 04a6a8a68f77..b77ff979da87 100644 --- a/dev-packages/rollup-utils/bundleHelpers.mjs +++ b/dev-packages/rollup-utils/bundleHelpers.mjs @@ -123,6 +123,12 @@ export function makeBaseBundleConfig(options) { }, plugins: [productionReplacePlugin], treeshake: treeShakePreset('smallest'), + optimization: { + // The default `'smart'` mode inlines constants only in conditions, leaving both a variable and + // literal copies of the same string. Inlining everywhere grows the raw output but shrinks it + // after gzip, since repeated literals compress better than variable references. + inlineConst: { mode: 'all' }, + }, }; const bundleTypeConfigMap = {