From 7085f0e3e46cd1fd41d952450b8d01b04de83daf Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Sat, 21 Sep 2024 07:48:32 +0200 Subject: [PATCH] refactor(sio-client): mangle private attributes | | before | after | |----------|---------|---------| | min+gzip | 14.6 KB | 14.3 KB | | min+br | 13.1 KB | 12.9 KB | Reference: https://terser.org/docs/options/#mangle-properties-options --- packages/socket.io-client/support/rollup.config.esm.js | 10 +++++++++- packages/socket.io-client/support/rollup.config.umd.js | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/socket.io-client/support/rollup.config.esm.js b/packages/socket.io-client/support/rollup.config.esm.js index 9105ec0cc5..ce54060c23 100644 --- a/packages/socket.io-client/support/rollup.config.esm.js +++ b/packages/socket.io-client/support/rollup.config.esm.js @@ -15,7 +15,15 @@ module.exports = { file: "./dist/socket.io.esm.min.js", format: "esm", sourcemap: true, - plugins: [terser()], + plugins: [ + terser({ + mangle: { + properties: { + regex: /^_/, + }, + }, + }), + ], banner, }, plugins: [ diff --git a/packages/socket.io-client/support/rollup.config.umd.js b/packages/socket.io-client/support/rollup.config.umd.js index 2d279111e3..0d83056d77 100644 --- a/packages/socket.io-client/support/rollup.config.umd.js +++ b/packages/socket.io-client/support/rollup.config.umd.js @@ -47,7 +47,15 @@ const prodBundle = { format: "umd", name: "io", sourcemap: true, - plugins: [terser()], + plugins: [ + terser({ + mangle: { + properties: { + regex: /^_/, + }, + }, + }), + ], banner, }, plugins: [