alonetone icon indicating copy to clipboard operation
alonetone copied to clipboard

Investigate production bundle size (>600k?!)

Open sudara opened this issue 7 years ago • 8 comments

Post Rails 7:

bundle exec bin/webpack --mode="production" 
bundle exec bin/webpack --profile --json > stats.json
yarn run webpack-bundle-analyzer stats.json public/packs/
rm stats.json

old:

bundle exec bin/webpack --mode="production"
cp public/packs/application-<hash>.js .
bundle exec bin/webpack --profile --json --mode="production" > stats.json
yarn run webpack-bundle-analyzer stats.json
whybundled stats.json 

https://webpack.github.io/analyse/#modules

sudara avatar Aug 26 '18 23:08 sudara

bn.js and elliptical were both being required because of old version vendered version of seed_random.js that required npm's crypto lib.

webpack bundle analyzer 2018-12-26 21-44-18

sudara avatar Dec 26 '18 20:12 sudara

Before seed random fix:

  application-72caa8338adf3ef56235.js (805 KiB)

After:

  application-3f1fa05da728c3318f79.js (462 KiB)

sudara avatar Dec 26 '18 20:12 sudara

Bundle situation afterwards:

image

sudara avatar Dec 26 '18 20:12 sudara

Before in production:

2018-12-26 21-56-31

After in production:

2018-12-26 22-02-14

sudara avatar Dec 26 '18 21:12 sudara

Changed gsap import style to get under 100kb zipped https://github.com/sudara/alonetone/commit/4005082f70940336d15190b8a0cf87b38a885456

2018-12-26 22-39-49

sudara avatar Dec 26 '18 21:12 sudara

rails6rc2

-rw-r--r--  1 sudara  staff   373K Dec  9 22:29 application-af7e003efad5bc86ad31.js

99.5kb as of Rails 6.1

sudara avatar Dec 09 '20 22:12 sudara

Just for tracking purposes

After updating to Rails 7 and Turbo and setting to "not IE 11"

image

sudara avatar Jan 18 '22 14:01 sudara

image

sudara avatar Jan 18 '22 14:01 sudara