Skip to content

feat: Migrate to Webpack Built-in Infrastructure Logger with Backward… - #738

Open
ronakmaheshwari wants to merge 3 commits into
webpack:mainfrom
ronakmaheshwari:main
Open

feat: Migrate to Webpack Built-in Infrastructure Logger with Backward…#738
ronakmaheshwari wants to merge 3 commits into
webpack:mainfrom
ronakmaheshwari:main

Conversation

@ronakmaheshwari

Copy link
Copy Markdown

This pull request updates the logging system of the webpack-bundle-analyzer plugin to integrate with Webpack's native infrastructure logger when available. It introduces a new adapter for compatibility, deprecates the plugin's logLevel option in favor of Webpack's infrastructureLogging, and updates documentation and type annotations accordingly.

Logging integration and deprecation:

  • The plugin now uses Webpack's infrastructure logger via compiler.getInfrastructureLogger('webpack-bundle-analyzer') when available, providing better integration with Webpack's logging system.
  • The logLevel option is deprecated in favor of Webpack's infrastructureLogging.level, with documentation and type comments updated to reflect this change. A deprecation warning is shown if logLevel is used. [1] [2] [3] [4] [5]

Logger implementation and type updates:

  • Introduces InfrastructureLoggerAdapter in Logger.js to bridge between the plugin's logger interface and Webpack's infrastructure logger, supporting log level filtering and deprecation warnings. [1] [2] [3]
  • Updates type annotations throughout the codebase (src/analyzer.js, src/utils.js, src/viewer.js) to accept either the custom Logger or Webpack's infrastructure logger for improved type safety and compatibility. [1] [2] [3] [4] [5] [6] [7]

These changes ensure that logging is consistent with Webpack's ecosystem and prepare for the eventual removal of the plugin's custom logLevel option compatibility

#358

@valscion if you can review it

@changeset-bot

changeset-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 242e5dd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
webpack-bundle-analyzer Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@linux-foundation-easycla

linux-foundation-easycla Bot commented Sep 10, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: ronakmaheshwari / name: ronak maheshwari (ad3efed)

@valscion

Copy link
Copy Markdown
Collaborator

Thanks! Could you follow the pull request template?

@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.80851% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.54%. Comparing base (21ab1c1) to head (ad3efed).

Files with missing lines Patch % Lines
src/Logger.js 96.51% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #738      +/-   ##
==========================================
+ Coverage   85.35%   86.54%   +1.18%     
==========================================
  Files          17       17              
  Lines        1065     1159      +94     
  Branches      387      415      +28     
==========================================
+ Hits          909     1003      +94     
  Misses        142      142              
  Partials       14       14              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ronakmaheshwari

Copy link
Copy Markdown
Author

Will do it today it self

Comment thread test/Logger.js
});
});

describe("parity methods", () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some type-level protection that makes sure the parity methods are kept in sync with what webpack has? I'm a bit worried about adding so many new methods in here and I wonder if there would be an alternative solution that wouldn't require us to match all the other webpack logger methods.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes in my latest commit ii have added a simplified approach. I have replaced the boilerplate with a proxy which will automatically delegates all Webpack logger methods directly to the underlying logger.

@valscion

Copy link
Copy Markdown
Collaborator

Also check the coverage report, some methods seem to bail out and not be tested

@alexander-akait alexander-akait left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this improvement

@ronakmaheshwari

Copy link
Copy Markdown
Author

Hii @valscion I have made the changes Can you review it please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants