Skip to content

Commit c64c4fd

Browse files
authored
ci: Improve size limit tree shaking handling (#16267)
By us providing an empty terser plugin we actually get weird results (the browser variant with tree shaking was actually larger then the default one :O). We can just use the defaults here. I also updated the GH action to use `bytes-iec` instead of `bytes` package for rendering the sizes - this is also what size-limit itself uses, so this should be better aligned now. Values may _look_ larger now because it formats as `kB` now (so factors of 1000) instead of `KiB` (factors of 1024).
1 parent cdf0445 commit c64c4fd

File tree

4 files changed

+3
-9
lines changed

4 files changed

+3
-9
lines changed

.size-limit.js

-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ module.exports = [
1818
limit: '24.1 KB',
1919
modifyWebpackConfig: function (config) {
2020
const webpack = require('webpack');
21-
const TerserPlugin = require('terser-webpack-plugin');
2221

2322
config.plugins.push(
2423
new webpack.DefinePlugin({
@@ -30,7 +29,6 @@ module.exports = [
3029
);
3130

3231
config.optimization.minimize = true;
33-
config.optimization.minimizer = [new TerserPlugin()];
3432

3533
return config;
3634
},
@@ -57,7 +55,6 @@ module.exports = [
5755
limit: '70.1 KB',
5856
modifyWebpackConfig: function (config) {
5957
const webpack = require('webpack');
60-
const TerserPlugin = require('terser-webpack-plugin');
6158

6259
config.plugins.push(
6360
new webpack.DefinePlugin({
@@ -69,7 +66,6 @@ module.exports = [
6966
);
7067

7168
config.optimization.minimize = true;
72-
config.optimization.minimizer = [new TerserPlugin()];
7369

7470
return config;
7571
},
@@ -239,7 +235,6 @@ module.exports = [
239235
ignore: [...builtinModules, ...nodePrefixedBuiltinModules],
240236
modifyWebpackConfig: function (config) {
241237
const webpack = require('webpack');
242-
const TerserPlugin = require('terser-webpack-plugin');
243238

244239
config.plugins.push(
245240
new webpack.DefinePlugin({
@@ -248,7 +243,6 @@ module.exports = [
248243
);
249244

250245
config.optimization.minimize = true;
251-
config.optimization.minimizer = [new TerserPlugin()];
252246

253247
return config;
254248
},

dev-packages/size-limit-gh-action/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@actions/github": "^5.0.0",
2121
"@actions/glob": "0.4.0",
2222
"@actions/io": "1.1.3",
23-
"bytes": "3.1.2",
23+
"bytes-iec": "3.1.1",
2424
"markdown-table": "3.0.3"
2525
},
2626
"volta": {

dev-packages/size-limit-gh-action/utils/SizeLimitFormatter.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as core from '@actions/core';
2-
import bytes from 'bytes';
2+
import bytes from 'bytes-iec';
33

44
const SIZE_RESULTS_HEADER = ['Path', 'Size', '% Change', 'Change'];
55

yarn.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -11367,7 +11367,7 @@ [email protected]:
1136711367
resolved "https://registry.yarnpkg.com/byte-size/-/byte-size-8.1.1.tgz#3424608c62d59de5bfda05d31e0313c6174842ae"
1136811368
integrity sha512-tUkzZWK0M/qdoLEqikxBWe4kumyuwjl3HO6zHTr4yEI23EojPtLYXdG1+AQY7MN0cGyNDvEaJ8wiYQm6P2bPxg==
1136911369

11370-
bytes-iec@^3.1.1:
11370+
bytes-iec@3.1.1, bytes-iec@^3.1.1:
1137111371
version "3.1.1"
1137211372
resolved "https://registry.yarnpkg.com/bytes-iec/-/bytes-iec-3.1.1.tgz#94cd36bf95c2c22a82002c247df8772d1d591083"
1137311373
integrity sha512-fey6+4jDK7TFtFg/klGSvNKJctyU7n2aQdnM+CO0ruLPbqqMOM8Tio0Pc+deqUeVKX1tL5DQep1zQ7+37aTAsA==

0 commit comments

Comments
 (0)