Skip to content

Fix webpack file size warnings on entrypoints#24374

Merged
yhwang merged 1 commit intoprestodb:masterfrom
unidevel:fix_size_warning
Jan 21, 2025
Merged

Fix webpack file size warnings on entrypoints#24374
yhwang merged 1 commit intoprestodb:masterfrom
unidevel:fix_size_warning

Conversation

@unidevel
Copy link
Contributor

Description

As in issue #22759, there are multiple wanrings about file size like this

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  index (508 KiB)
      target/webapp/index.js
  query (596 KiB)
      target/webapp/query.js
  plan (558 KiB)
      target/webapp/plan.js
  query_viewer (674 KiB)
      target/webapp/dev/query_viewer.js
  embedded_plan (554 KiB)
      target/webapp/embedded_plan.js
  stage (564 KiB)
      target/webapp/stage.js
  worker (496 KiB)
      target/webapp/worker.js
  timeline (486 KiB)
      target/webapp/timeline.js
  res_groups (496 KiB)
      target/webapp/res_groups.js
  sql_client (720 KiB)
      target/webapp/sql_client.js

Motivation and Context

Impact

Introduce react dynamic import for code splitting
Also added the webpack splitChunks configuration to split large dependencies

Test Plan

Require function testing on presto-ui

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

== NO RELEASE NOTE ==

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 16, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: unidevel / name: unidevel (9c85351)

@unidevel unidevel added the from:IBM PR from IBM label Jan 17, 2025
@prestodb-ci prestodb-ci requested review from a team, bibith4 and pratyakshsharma and removed request for a team January 17, 2025 15:06
@unidevel unidevel changed the title fix webpack file size warnings(>244k) on entrypoints Fix webpack file size warnings(>244k) on entrypoints Jan 17, 2025
@unidevel unidevel changed the title Fix webpack file size warnings(>244k) on entrypoints Fix webpack file size warnings on entrypoints Jan 17, 2025
@unidevel
Copy link
Contributor Author

After this PR applied, yarn install will output:

yarn install v1.22.22
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
warning " > vis-timeline@7.7.3" has unmet peer dependency "@egjs/hammerjs@^2.0.0".
warning " > vis-timeline@7.7.3" has unmet peer dependency "component-emitter@^1.3.0".
warning " > vis-timeline@7.7.3" has unmet peer dependency "keycharm@^0.2.0 || ^0.3.0 || ^0.4.0".
warning " > vis-timeline@7.7.3" has unmet peer dependency "moment@^2.24.0".
warning " > vis-timeline@7.7.3" has unmet peer dependency "propagating-hammerjs@^1.4.0 || ^2.0.0".
warning " > vis-timeline@7.7.3" has unmet peer dependency "uuid@^3.4.0 || ^7.0.0 || ^8.0.0 || ^9.0.0".
warning " > vis-timeline@7.7.3" has unmet peer dependency "vis-data@^6.3.0 || ^7.0.0".
warning " > vis-timeline@7.7.3" has unmet peer dependency "vis-util@^5.0.1".
warning " > vis-timeline@7.7.3" has unmet peer dependency "xss@^1.0.0".
[5/5] 🔨  Building fresh packages...
$ webpack --env=production --config 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
[BABEL] Note: The code generator has deoptimised the styling of /Users/jerry/my/presto/presto-ui/src/sql-parser/SqlBaseParser.js as it exceeds the max of 500KB.
assets by path vendor/ 6.06 MiB 60 assets
assets by path *.js 2.65 MiB 47 assets
assets by path *.html 16.5 KiB
  asset timeline.html 3.18 KiB [compared for emit] [from: static/timeline.html] [copied]
  + 8 assets
assets by path assets/ 22.4 KiB
  asset assets/presto.css 13.5 KiB [compared for emit] [from: static/assets/presto.css] [copied]
  + 2 assets
assets by path dev/*.html 301 KiB
  asset dev/query_viewer_spa.html 297 KiB [compared for emit] [big]
  asset dev/index.html 3.41 KiB [compared for emit] [from: static/dev/index.html] [copied]
assets by path tableau/ 12.8 KiB
  asset tableau/presto-connector.html 11.2 KiB [compared for emit] [from: static/tableau/presto-connector.html] [copied]
  asset tableau/presto-client.js 1.57 KiB [compared for emit] [from: static/tableau/presto-client.js] [copied] [minimized]
asset target/webapp/dev/query_viewer.js 146 KiB [compared for emit] [minimized] (name: query_viewer)
orphan modules 562 KiB [orphan] 431 modules
runtime modules 73.5 KiB 132 modules
built modules 2.36 MiB [built]
  modules by path ./node_modules/ 1.37 MiB 468 modules
  modules by path ./components/ 437 KiB 22 modules
  modules by path ./*.jsx 16.7 KiB 10 modules
  modules by path ./static/ 140 KiB 6 modules
  modules by path ./*.js 12.8 KiB
    ./utils.js 11.8 KiB [built] [code generated]
    ./d3utils.js 998 bytes [built] [code generated]
  modules by path ./sql-parser/*.js 405 KiB
    ./sql-parser/SqlBaseParser.js 367 KiB [built] [code generated]
    ./sql-parser/SqlBaseListener.js 38.5 KiB [built] [code generated]
  external "vis" 42 bytes [built] [code generated]

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
  983.chunk.js (278 KiB)
  vendor/vis-timeline/vis-timeline-graph2d.js (569 KiB)
  vendor/vis-timeline/vis-timeline-graph2d.min.js (565 KiB)
  vendor/vis-timeline/vis-timeline-graph2d.min.js.map (2.12 MiB)
  vendor/vis/dist/vis.js (433 KiB)
  vendor/vis/dist/vis.map (574 KiB)
  vendor/vis/dist/vis.min.js (434 KiB)
  dev/query_viewer_spa.html (297 KiB)

webpack 5.88.2 compiled with 1 warning in 6536 ms
✨  Done in 8.35s.

@unidevel unidevel marked this pull request as ready for review January 20, 2025 19:58
@unidevel unidevel requested review from a team and yhwang as code owners January 20, 2025 19:58
@unidevel unidevel requested a review from presto-oss January 20, 2025 19:58
Copy link
Member

@yhwang yhwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/LGTM

nice to split the large files and lazy loading components

@yhwang yhwang merged commit 74d7ee7 into prestodb:master Jan 21, 2025
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants