-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
use sourcemaps to get a more accurate bundle-report #4463
Conversation
|
Nice! Have you seen https://github.com/danvk/source-map-explorer? I believe the underlying library can be used standalone as well. |
@devongovett wow I didn't know that already existed. Looks pretty cool. However I don't think we should include an additional library for this as we've already done all the heavy lifting by writing so many utilities around handling sourcemaps, so this PR is basically just a simple loop through all the mappings. Might be nice to look through how it's implemented though, will look through it. (just looked through and it's apparently super simple with the sourcemapconsumer from Mozilla, might be interesting to add something similar to eachMapping to |
In the "after" screenshot, kitchen-sink.[hash].js has a couple 0 byte assets — is that accurate? |
@wbinnssmith it should be relatively accurate, it probably means there's no mappings with the origin to that asset. |
@wbinnssmith just double checked and it's a bug with the sourcemap. When throwing it in the sourcemap visualiser it shows up as |
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.
We should update the bundle analyzer with this too.
One question: what kind of performance cost does this add to large builds? Do we need to bring back the --detailed-report flag?
@devongovett I'm not sure about any performance cost, I doubt it would be a very large impact, it's just a relatively simple loop. Will check with the threejs benchmark. Nvm apparently the |
Not really, but I was aware of how the threejs benchmark is failing. Investigating now... |
Co-Authored-By: Niklas Mischkulnig <[email protected]>
If you replace |
@devongovett I ran the threejs benchmark and it takes about 1-2 seconds on my machine to show the build report, so maybe it's a good idea to add the flag? Or I could just log |
I thought about that as well. I guess the question is if disabling sourcemaps completely (e.g. also for babel-parser) has a significant performance benefit.
The same goes for some scope hoisting missing export diagnostics |
@wbinnssmith It depends on how much anyone cares about performance. I think it saves us quite some time to not generate any sourcemaps. Maybe it should generate sourcemaps every time the However as nobody probably wants this to be put into dist when using This report should still work without a sourcemap though, but it would be identical to before this PR... Probably best to implement the |
↪️ Pull Request
Closes #4368
This Pull Request is a work in progress to use sourcemaps to get a more accurate build report after minification and treeshaking.
It is not entirely accurate as our sourcemaps aren't entirely accurate or complete, but it's a lot better than before.
Before:
After: