Skip to content

Commit 4f66708

Browse files
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
1 parent 1a95db2 commit 4f66708

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

packages/socket.io-client/support/rollup.config.umd.js

+18-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ const devBundle = {
2727
babel({
2828
babelHelpers: "bundled",
2929
presets: [["@babel/env"]],
30-
plugins: ["@babel/plugin-transform-object-assign"],
30+
plugins: [
31+
"@babel/plugin-transform-object-assign",
32+
[
33+
"@babel/plugin-transform-classes",
34+
{
35+
loose: true,
36+
},
37+
],
38+
],
3139
}),
3240
],
3341
};
@@ -49,7 +57,15 @@ const prodBundle = {
4957
babel({
5058
babelHelpers: "bundled",
5159
presets: [["@babel/env"]],
52-
plugins: ["@babel/plugin-transform-object-assign"],
60+
plugins: [
61+
"@babel/plugin-transform-object-assign",
62+
[
63+
"@babel/plugin-transform-classes",
64+
{
65+
loose: true,
66+
},
67+
],
68+
],
5369
}),
5470
],
5571
};

0 commit comments

Comments
 (0)