From 4f667082108235209df81d44f453826a3f5c08e7 Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Sat, 21 Sep 2024 07:44:15 +0200 Subject: [PATCH] chore(sio-client): use babel loose mode when transpiling classes By default, Babel uses `Object.defineProperty()` when transpiling classes. We'll now use the loose mode which creates a more terse output. | | before | after | |----------|---------|---------| | min+gzip | 14.9 KB | 14.6 KB | | min+br | 13.4 KB | 13.1 KB | Reference: https://babeljs.io/docs/babel-plugin-transform-classes --- .../support/rollup.config.umd.js | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/socket.io-client/support/rollup.config.umd.js b/packages/socket.io-client/support/rollup.config.umd.js index 8d05dca81..2d279111e 100644 --- a/packages/socket.io-client/support/rollup.config.umd.js +++ b/packages/socket.io-client/support/rollup.config.umd.js @@ -27,7 +27,15 @@ const devBundle = { babel({ babelHelpers: "bundled", presets: [["@babel/env"]], - plugins: ["@babel/plugin-transform-object-assign"], + plugins: [ + "@babel/plugin-transform-object-assign", + [ + "@babel/plugin-transform-classes", + { + loose: true, + }, + ], + ], }), ], }; @@ -49,7 +57,15 @@ const prodBundle = { babel({ babelHelpers: "bundled", presets: [["@babel/env"]], - plugins: ["@babel/plugin-transform-object-assign"], + plugins: [ + "@babel/plugin-transform-object-assign", + [ + "@babel/plugin-transform-classes", + { + loose: true, + }, + ], + ], }), ], };