portagenetwork / roadmap

Developed by the the Alliance in collaboration with University of Alberta, DMP Assistant a data management planning tool, forking the DMP Roadmap codebase
MIT License
6 stars 1 forks source link

Warning during asset compilation: application.js exceeding recommended size limit #711

Open aaronskiba opened 3 months ago

aaronskiba commented 3 months ago

Please complete the following fields as applicable:

What version of the DMPRoadmap code are you running? (e.g. v2.2.0)

Terminal Output The following is copied from the Compile Assets step of the postgresql GitHub Action here:

Run bundle exec rails assets:precompile
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
Copying Bootstrap glyphicons to the public directory ...
Copying TinyMCE skins to the public directory ...
yarn install v1.22.22
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.27s.
yarn run v1.22.22
$ webpack --config ./config/webpack/webpack.config.js
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
Running via Spring preloader in process 4788
Running via Spring preloader in process 4792
asset application.js 1.73 MiB [emitted] [minimized] [big] (name: application) 1 related asset
orphan modules 555 KiB [orphan] 67 modules
runtime modules 939 bytes 4 modules
modules by path ./node_modules/core-js/ 541 KiB 521 modules
modules by path ./node_modules/tinymce/ 2.68 MiB 17 modules
modules by path ./app/javascript/ 569 KiB 16 modules
modules by path ./node_modules/jquery-ui/ui/ 209 KiB
  modules by path ./node_modules/jquery-ui/ui/*.js 40.2 KiB 9 modules
  modules by path ./node_modules/jquery-ui/ui/widgets/*.js 169 KiB 5 modules
modules by path ./node_modules/bootstrap/ 73.6 KiB
  ./node_modules/bootstrap/dist/js/npm.js 484 bytes [built] [code generated]
  + [12](https://github.com/portagenetwork/roadmap/actions/runs/8396151602/job/22996926017?pr=700#step:17:13) modules
modules by path ./node_modules/number-to-text/ 4.09 KiB
  ./node_modules/number-to-text/converters/en-us.js 2.74 KiB [built] [code generated]
  + 2 modules
+ 5 modules

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  application.js (1.73 MiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  application (1.73 MiB)
      application.js

WARNING in webpack performance recommendations: 
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/

webpack 5.79.0 compiled with 3 warnings in 23968 ms
Done in 24.62s.
yarn install v1.[22](https://github.com/portagenetwork/roadmap/actions/runs/8396151602/job/22996926017?pr=700#step:17:23).22
[1/4] Resolving packages...
success Already up-to-date.
aaronskiba commented 3 months ago

Note that the same warnings exist within the DMP Roadmap codebase. Their warning also states application.js (1.73 MiB) link.

aaronskiba commented 3 months ago

The following check was performed after performing rails assets:clobber && rails assets:precompile each time:

// deployment-portage with webpacker
aaron@ubuntu:~/Documents/GitHub/roadmap
$ ls -lh public/packs/js/application-f9a747a97913655770dd.js
-rw-rw-r-- 1 aaron aaron 1.9M Apr  5 15:23 public/packs/js/application-f9a747a97913655770dd.js

// v4.1.1 upgrade with jsbundling-rails
aaron@ubuntu:~/Documents/GitHub/roadmap
$ ls -lh app/assets/builds/application.js
-rw-rw-r-- 1 aaron aaron 1.8M Apr  5 15:25 app/assets/builds/application.js

Although both files far exceed Webpack's recommended size limit, application.js is slightly smaller after the upgrade.

aaronskiba commented 3 months ago

https://webpack.js.org/guides/code-splitting/