rapier.js icon indicating copy to clipboard operation
rapier.js copied to clipboard

refactor: use # for private methods to reduce the minified file size

Open Master-Hash opened this issue 3 months ago • 0 comments

This PR reduces the bundle size using # for the private properties instead of the private keyword when the code is minified.

The results of esbuild ./rapier.js --bundle --minify --target=esnext --format=esm --outfile=out.js:

-a---          2025/10/23    19:36         112241 old.js
-a---          2025/10/23    20:12         111075 new.js

which is about 1.04% smaller. If you can find more private methods/property, It can be even smaller.

The principle is explained here.

The PR is tested on my own app.

Master-Hash avatar Oct 23 '25 12:10 Master-Hash