rapier.js
rapier.js copied to clipboard
refactor: use # for private methods to reduce the minified file size
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.