From 4aec72a53cca0e6eb300ce075a8ed4881c459579 Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Fri, 31 May 2024 18:35:31 +0200 Subject: [PATCH] chore: 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 | 8.8 KB | 8.6 KB | | min+br | 8.0 KB | 7.7 KB | Reference: https://babeljs.io/docs/babel-plugin-transform-classes --- support/rollup.config.umd.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/support/rollup.config.umd.js b/support/rollup.config.umd.js index affbec66..c8fe9e9b 100644 --- a/support/rollup.config.umd.js +++ b/support/rollup.config.umd.js @@ -37,7 +37,15 @@ module.exports = { babel({ babelHelpers: "bundled", presets: [["@babel/env"]], - plugins: ["@babel/plugin-transform-object-assign"], + plugins: [ + "@babel/plugin-transform-object-assign", + [ + "@babel/plugin-transform-classes", + { + loose: true, + }, + ], + ], }), ], };