Skip to content

migrate on webpack built-in logger #358

Closed

Description

@alexander-akait

Issue description

Migrate on built-in webpack logger API https://webpack.js.org/api/logging/

Technical info

  • Webpack Bundle Analyzer version: latest
  • Webpack version: any
  • Node.js version: any
  • npm/yarn version: any
  • OS: any

Debug info

Allow to filter and configure logger options from configuration(s) + allow to collect logs from stats

What other Webpack plugins were used?

Irrelevant

Activity

  1. valscion commented on Jun 10, 2020

    @valscion
    Collaborator

    This would make webpack-bundle-analyzer only compatible with webpack v4.39.0 and forwards. Right now we're compatible with even webpack v3 if I remember correctly, so this would be a major version bump.

  2. alexander-akait commented on Jun 10, 2020

    @alexander-akait
    MemberAuthor

    We can't avoid breaking change using:

    const logger = logging.getLogger ? logging.getLogger('webpack-bundle-analyzer') : oldLogger;
    
  3. valscion commented on Jun 10, 2020

    @valscion
    Collaborator

    Ah cool idea! That would be a possible idea.

  4. jamesgeorge007 commented on Jun 17, 2020

    @jamesgeorge007
    Contributor

    I would love to give it a shot 🙌

  5. ronakmaheshwari commented on Aug 16, 2026

    @ronakmaheshwari
    Contributor

    Hey! I'd like to take a shot at this one. Before writing code, wanted to check in on a couple of things that touch public API behavior.

    Plan: swap the custom Logger for webpack's built-in logger (compiler.getInfrastructureLogger(name)) across BundleAnalyzerPlugin.js and viewer.js. Bonus: this gives us time()/timeEnd() for free, which should help close #499 too.

    Two questions:

    1. logLevel option — right now it's plugin-local and filters our custom logger. Webpack's built-in logger doesn't have a per-plugin level; it's global via infrastructureLogging.level. I can either wrap the built-in logger to preserve logLevel exactly as-is, or drop our filtering and document that verbosity now follows the user's infrastructureLogging config (more webpack-native, but breaking). Which way would you want to go?

    2. CLI mode — src/bin/analyzer.js has no live compiler (it reads a static stats.json), so it can't use the built-in logger. The custom Logger class would stay for CLI only; this migration is plugin-mode only.

    Let me know if this tracks, happy to open a PR once I've got a steer on logLevel.

    @valscion @alexander-akait

  6. evenstensberg commented on Aug 16, 2026

    @evenstensberg
    Member

    Sure open a pr, should be trivial. Import the logger and remove old logging

  7. valscion commented on Aug 17, 2026

    @valscion
    Collaborator

    Is there a middle ground where we would be able to have backwards-compatible change for one release and then we can later drop the compat support and bump the major version?

  8. ronakmaheshwari commented on Sep 10, 2026

    @ronakmaheshwari
    Contributor

    @valscion @evenstensberg i have made the changes can you review and provide me with a feedback?

  9. valscion commented on Sep 29, 2026

    @valscion
    Collaborator

    I'll close this issue as #738 basically has resolved this one now.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions