Skip to content
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

Show source files for vite bundled dependencies correctly #6

Open
hybridherbst opened this issue May 13, 2024 · 2 comments
Open

Show source files for vite bundled dependencies correctly #6

hybridherbst opened this issue May 13, 2024 · 2 comments

Comments

@hybridherbst
Copy link

hybridherbst commented May 13, 2024

Hey, I stumbled upon this tool on your Twitter, and it is indeed very fast and nice to navigate Chrome profiles with it.
One issue I ran into is that when using vite (which pre-bundles JS dependencies), the output looks like this – instead of showing which source file the code comes from, it's just displayed as coming from the prebundled chunks:

image

While the function names are readable, where the methods are coming from is all just from the chunks that vite has generated.
I'm not entirely sure but I believe all that data (which files these methods actually come from) should be part of the source maps vite already generates.

Would it be possible to show better file information in the trace based on that? Or is that an issue with how chrome creates the trace file?

@lahmatiy
Copy link
Owner

@hybridherbst Thank you for your feedback and for bringing up this issue.

Currently, Chrome generates traces without applying source maps. Specifically, Chrome does not modify the locations returned by the V8 profiler. Source maps are only utilized by developer tools on demand and are not included in Chrome traces (Chromium Performance Profile) by default.

To achieve better file information for bundled code, source maps need to be applied to a .cpuprofile or Chromium performance profile on your side. I'm planning to add functionality that will allow users to upload source maps into cpupro and apply them to a profile. However, there is no ETA for the feature at the moment. More likely, this capability might be implemented via CLI first. Nevertheless, you will need to obtain and manage the source maps on your side anyway.

@hybridherbst
Copy link
Author

Thanks for the response!

source maps need to be applied to a .cpuprofile or Chromium performance profile on your side

Is that a process where tooling exists already? I'm not aware of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants