question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: Allow JSON and HTML output at the same time.

See original GitHub issue

Rather than adding the plugin twice with e.g.:

[
      new BundleAnalyzerPlugin({
        analyzerMode: 'static',
        openAnalyzer: false,
        reportFilename: 'webpack-report/index.html'),
      }),
      new BundleAnalyzerPlugin({
        analyzerMode: 'json',
        openAnalyzer: false,
        reportFilename: 'webpack-report/index.json'),
      }),
]

it would be nice to be able to generate JSON and HTML in one go, e.g.:

[
  new BundleAnalyzerPlugin({
    analyzerMode: "static",
    openAnalyzer: false,
    reportOutput: [
      { type: "json", fileName: "webpack-report/index.json" },
      { type: "html", fileName: "webpack-report/index.html" },
    ],
  }),
];

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
th0rcommented, Apr 28, 2021

Hmm yeah, I think adding support for analyzerMode possibly being an array would be reasonable.

Well, I think we can do that, but it will require a change to reportFilename option to be able to return different filenames for different report types e.g. allow to make it a function (reportType) => <reportFilename> (which won’t work for CLI) or an object {<reportType>: <reportFilename>}. Anyway, options becomes a mess… We definitely need to ship a new major version with completely revised API with pluggable external reporters.

1reaction
Gongregcommented, Apr 28, 2021

Sorry, I don’t have a lot of time currently, but as a workaround, you can also generate your own html file:

Published webpack-bundle-analyzer has a file called: webpack-bundle-analyzer/public/viewer.js

That file tries to read window.chartData. If you create a HTML file with the json data set to the window.chartData, and include the script file it should render correctly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

in express.js, any way to capture request to both json and html ...
I believe res.format() is the way to do this in Express 3.x and 4.x: res.format({ text: function(){ res.send('hey'); }, html: function(){ ...
Read more >
Add feature to allow returning JSON output as a block - Drupal
For my request, I still need to be able to get the data in a standard JSON format. The way that I get...
Read more >
Best practices for REST API design - Stack Overflow Blog
REST APIs should accept JSON for request payload and also send responses to JSON. JSON is the standard for transferring data.
Read more >
Here are the most popular ways to make an HTTP request in ...
In this article, we are going to look at a few popular ways to make HTTP requests in JavaScript. Ajax Ajax is the...
Read more >
Splash HTTP API — Splash 1.0 documentation - Read the Docs
This option is only supported for application/json POST requests. Value could be either a ... Arguments for this endpoint are the same as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found