Skip to content

Commit 0876752

Browse files
authored
build(ui): Set only the runtime chunk option (#95285)
1 parent ca9278a commit 0876752

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

rspack.config.ts

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -228,23 +228,6 @@ const swcReactLoaderConfig: SwcLoaderOptions = {
228228
isModule: 'unknown',
229229
};
230230

231-
const minimizer = [
232-
new rspack.LightningCssMinimizerRspackPlugin(),
233-
new rspack.SwcJsMinimizerRspackPlugin({
234-
minimizerOptions: {
235-
compress: {
236-
// We are turning off these 3 minifier options because it has caused
237-
// unexpected behaviour. See the following issues for more details.
238-
// - https://github.com/swc-project/swc/issues/10822
239-
// - https://github.com/swc-project/swc/issues/10824
240-
reduce_vars: false,
241-
inline: 0,
242-
collapse_vars: false,
243-
},
244-
},
245-
}),
246-
];
247-
248231
/**
249232
* Main Webpack config for Sentry React SPA.
250233
*/
@@ -549,7 +532,22 @@ const appConfig: Configuration = {
549532
},
550533

551534
// This only runs in production mode
552-
minimizer,
535+
minimizer: [
536+
new rspack.LightningCssMinimizerRspackPlugin(),
537+
new rspack.SwcJsMinimizerRspackPlugin({
538+
minimizerOptions: {
539+
compress: {
540+
// We are turning off these 3 minifier options because it has caused
541+
// unexpected behaviour. See the following issues for more details.
542+
// - https://github.com/swc-project/swc/issues/10822
543+
// - https://github.com/swc-project/swc/issues/10824
544+
reduce_vars: false,
545+
inline: 0,
546+
collapse_vars: false,
547+
},
548+
},
549+
}),
550+
],
553551
},
554552
devtool: IS_PRODUCTION ? 'source-map' : 'eval-cheap-module-source-map',
555553
};
@@ -781,10 +779,8 @@ if (IS_UI_DEV_ONLY) {
781779
rewrites: [{from: /^\/.*$/, to: '/_assets/index.html'}],
782780
},
783781
};
784-
appConfig.optimization = {
785-
runtimeChunk: 'single',
786-
minimizer,
787-
};
782+
// Hot reloading breaks if we aren't using a single runtime chunk
783+
appConfig.optimization!.runtimeChunk = 'single';
788784
}
789785

790786
if (IS_UI_DEV_ONLY || SENTRY_EXPERIMENTAL_SPA) {

0 commit comments

Comments
 (0)