Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate build tooling to Vite #1226
Migrate build tooling to Vite #1226
Changes from 1 commit
426f021
dfdb18f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to file an issue in this repo to track this and explain what needs to be done once the redux issue is resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unexpected. Is the browser supposed to interpret a typescript file?
I also wonder about the /src/ prefix, how that would work with jaeger-query
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It gets replaced with a proper asset at build time (https://vitejs.dev/guide/features.html#typescript).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please compare the size of the overall ui-asset bundle after switching to Vite? Add it to the PR description as a benchmarking data point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the last CI build from
main
, the results from CRA are:That'd be ~1519 kB of JS (gzipped) and ~54 kB of CSS (gzipped).
For this branch, we have:
So the JS bundle ends up larger. Not immediately sure what the increase is due to; will add
rollup-plugin-visualizer
locally to try and hopefully determine that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One finding: the old build system used
babel-plugin-import
not just for theantd
handling but also for magically optimizinglodash
imports. Most places already uselodash/subComponent
import style to only import needed code, but some import the entire library. Locally, changing those to all use appropriate subcomponent imports shaved off ~30 kB from the gzipped bundle.With that, the bundle ends up like this:
It seems the biggest opportunity for saving some bytes would be to lazy-load dependencies that are only needed on specific pages, e.g.
plexus
, or the pyroscope flamegraph visualizer.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, lazy loading those would be good. Does it require changing the build to produce several js files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is doable by using dynamic imports for the chunks that we want to lazyload. I tested locally with
DAG.jsx
by moving the top-level imports forcytoscape
and related deps into thecomponentDidMount
callback:This split out these dependencies from the main chunk and Vite automatically generated separate chunks for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the issue with
lodash
, we could make a separate PR to convert the few usages where the entirety oflodash
is imported into appropriate sub-component imports. Alternatively, it could also be solved by switching it out forlodash-es
, which islodash
but built as ES modules, makingimport { foo } from 'lodash-es'
"just work" without requiring a special plugin (it'd only importfoo
and not the whole library).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed #1233 and #1234 to track these.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ mszabo-wikia do you know why/if these were needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is likely an artifact. I thought it was still being used by tests for SVG support, but it seems those use
babel-plugin-inline-react-svg
instead (test/babel-transform.js). So these are probably OK to remove assuming that tests pass without them.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, appreciate your comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for reaching out! :)