Skip to content

Commit

Permalink
chore(sio-client): use babel loose mode when transpiling classes
Browse files Browse the repository at this point in the history
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
  • Loading branch information
darrachequesne committed Sep 21, 2024
1 parent 1a95db2 commit 4f66708
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions packages/socket.io-client/support/rollup.config.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
],
],
}),
],
};
Expand All @@ -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,
},
],
],
}),
],
};
Expand Down

0 comments on commit 4f66708

Please sign in to comment.