next.js icon indicating copy to clipboard operation
next.js copied to clipboard

feat(bundle-analyzer): pass any config to bundle-analyzer

Open prescottprue opened this issue 3 years ago • 10 comments

Feature

  • Add ability to pass any config to @next/bundle-analyzer including 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

prescottprue avatar Aug 30 '22 00:08 prescottprue

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.

prescottprue avatar Nov 25 '22 21:11 prescottprue

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`
}

prescottprue avatar Jul 18 '23 23:07 prescottprue

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?

refex avatar Aug 02 '23 14:08 refex

Any update here? I was checking to add the same things, and I found this PR. It would be really helpful update 😄

dacunagm avatar Oct 24 '23 17:10 dacunagm

That would help a lot! Thank you!

olegakbarov avatar Apr 22 '24 19:04 olegakbarov

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

ijjk avatar May 03 '24 16:05 ijjk

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

ijjk avatar May 03 '24 16:05 ijjk

Is anything else needed here? Its been almost 2 years that this small PR has been open

prescottprue avatar May 03 '24 16:05 prescottprue

Officially 2 years this has been open - is there something else needed here?

prescottprue avatar Aug 30 '24 22:08 prescottprue

ping

ldrv565 avatar Oct 17 '24 09:10 ldrv565

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!

timneutkens avatar Nov 19 '25 14:11 timneutkens