JSON report from bundle-analyzer #40152
prescottprue
started this conversation in
Ideas
Replies: 2 comments
-
As called out here: #40071 (comment) recent change still does not allow for |
Beta Was this translation helpful? Give feedback.
0 replies
-
Posting this for anyone it may be useful for. I am using a script to pull the data out of the generated html file:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the feature you'd like to request
Ability to generate JSON bundle size reports from
@next/bundle-analyzer
. This is a useful way to write automation to confirm that NextJS bundle sizes haven't grown beyond an expected size. Our team is planning to have checks fail in CI if our bundle are over a certain size - by generating JSON reports from@next/bundle-analyzer
we were able to do so. We think this feature would be useful for others.Describe the solution you'd like
This can be accomplished leveraging webpack-bundle-analyzer's already built in functionality by passing along configuration within
@next/bundle-analyzer
towebpack-bundle-analyzer
.Describe alternatives you've considered
I was able to do this by passing along
analyzerMode
from options of@next/bundle-analyzer
- below are options which range in configurability and API interfaceJust Use webpack-bundle-analyzer directly
If you use
webpack-bundle-analyzer
instead of@next/bundle-analyzer
it is possible to pass your own settings (mirroring how next-bundle-analyzer works). This is cumbersome to repeat across muiltiple NextJS project and pushes devs away from@next/bundle-analyzer
Minimal API Surface
when going this route it is clear that the report file type should be able to switch between HTML and JSON:
usage
@next/bundle-analyzer
More Configurable
Exposing ability to set report filenames makes it so that the user can provide path for reports - it is nice to still handle the prefix difference so that the dev doesn't need to be aware of that (so both client and server paths have the same base):
usage
@next/bundle-analyzer
Most Configurable
Ability to pass a function which generates configuration - this would allow the user to configure webpack-bundle-analyzer however they want. Though this gives the ability to do anything, it almost defeats the purpose of the pre-configuring that @next/bundle-analyzer intends to do since the user needs to set all config
usage
@next/bundle-analyzer
Beta Was this translation helpful? Give feedback.
All reactions