FIX: Adjust swc minify options for Safari 15 support (#28098)

By default, the swc minifier seems to unwrap 'unneeded' IIFE. That means it was undoing the 'bugfix' transformation we have for class fields in Safari 15. Disabling the 'inline' and 'reduce_funcs' options seems to stop this behavior.
This commit is contained in:
David Taylor 2024-07-26 17:46:31 +01:00 committed by GitHub
parent cec8445f14
commit d141adb872
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -145,6 +145,14 @@ module.exports = function (defaults) {
minimizer: [
new TerserPlugin({
minify: TerserPlugin.swcMinify,
terserOptions: {
compress: {
// Stop swc unwrapping 'unnecessary' IIFE wrappers which are added by Babel
// to workaround a bug in Safari 15 class fields.
inline: false,
reduce_funcs: false,
},
},
}),
],
},