Skip to content

Override analyzerMode via environment variable #613

Description

@dleavitt

Issue description

By default, webpack bundle analyzer starts a server, which means that the webpack process will never terminate.

This is undesirable in CI and other non-interactive environments - your jobs will hang indefinitely. Currently (as far as I can tell) there's no way to prevent this from happening without changing the webpack configuration code. This isn't always possible in CI (e.g. it's someone else's code, or it's an older version of your own code prior to the configuration change.)

It would be great if there was some way to override the analyzerMode setting from the command-line, e.g. WEBPACK_BUNDLE_ANALYZER_MODE=json which could be set in non-interactive environments to ensure that the process will never hang.

Happy to submit a PR if this sounds useful.

Technical info

  System:
    OS: macOS 11.5.2
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 260.25 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.0 - ~/.nodenv/versions/16.14.0/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.3.1 - ~/.nodenv/versions/16.14.0/bin/npm
  npmPackages:
    compression-webpack-plugin: ^10.0.0 => 10.0.0 
    css-minimizer-webpack-plugin: ^4.2.2 => 4.2.2 
    fork-ts-checker-webpack-plugin: ^8.0.0 => 8.0.0 
    terser-webpack-plugin: 5 => 5.3.7 
    webpack: 5 => 5.82.0 
    webpack-assets-manifest: 5 => 5.1.0 
    webpack-bundle-analyzer: ^4.5.0 => 4.8.0 
    webpack-cli: 5 => 5.0.2 
    webpack-dev-server: ^4.7.4 => 4.13.3 
    webpack-merge: 5 => 5.8.0 

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions