next.js
next.js copied to clipboard
feat(bundle-analyzer): pass any config to bundle-analyzer
Feature
- Add ability to pass any config to
@next/bundle-analyzerincluding the ability to generate JSON bundle size reports
fixes #40069
- [X] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] Related issues linked using
fixes #number - [ ] Integration tests added
- [X] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see
contributing.md
Documentation / Examples
- [X] Make sure the linting passes by running
pnpm lint - [X] The examples guidelines are followed from our contributing doc
Hey folks - is there anything else missing on this PR? It would be great to be able to report to JSON so we can add some automation confirming they aren't growing too large.
It appears that https://github.com/vercel/next.js/pull/47468 was an attempt to add the ability to pass configuration for supporting json reports, but the output paths are still hardcoded for HTML.
Is there any changes needed to get this in like one of the more simple solution proposed in the discussion? Without the function it limits the ability to return settings based on webpack settings, I'm open to anything, just looking to be able to set:
{
analyzerMode: 'json',
reportFilename: options.isServer
? `../analyze/server.json`
: `./analyze/client.json`
}
This is the fifth issue i see about allowing the opt-in output of json file. Why is this still not possible after so many feedbacks?
Any update here? I was checking to add the same things, and I found this PR. It would be really helpful update 😄
That would help a lot! Thank you!
Allow CI Workflow Run
- [ ] approve CI run for commit: 1bd1931bdf8a9cf2e2b0b205deaf310588513365
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer
Allow CI Workflow Run
- [ ] approve CI run for commit: 06ca6c1a5f2ed84434b35a1273748aee335c3aad
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer
Is anything else needed here? Its been almost 2 years that this small PR has been open
Officially 2 years this has been open - is there something else needed here?
ping
First of, sorry for this PR getting lost and not getting a reply.
At this point we're not planning to make changes to @next/bundle-analyzer. It has the options that are intended to be exposed. The reason this wasn't landed before is that we've been working on a new bundler (Turbopack) and any option publicly exposed would have to match behavior with what was already there.
If you want to configure those options you can customize webpack config and add webpack-bundle-analyzer manually for that case.
For Turbopack we're working on a much better bundle analysis tool for Next.js applications. More details here: https://x.com/timneutkens/status/1990841104552357905.
Thanks for the PR!