Skip to content

Incorrect total size in search result #251

Closed

Description

@kyriiherman

Issue description

When I search for some modules total size isn't correct. It looks like total size is folder size + size of each file in folder

Technical info

  • Webpack Bundle Analyzer version: 3.0.3
  • Webpack version: 4.19.1
  • Node.js version: 11.9.0
  • npm/yarn version: 1.13.0
  • OS: macOS Mojave

Debug info

How do you use this module? As CLI utility or as plugin?
plugin

If plugin, what options were provided? (e.g. new BundleAnalyzerPlugin({ analyzerMode: 'disabled', generateStatsFile: true }))
{ openAnalyzer: false }

screen shot 2019-02-14 at 13 04 00

Activity

  1. valscion commented on Feb 14, 2019

    @valscion
    Collaborator

    Hmm are you sure your lodash in 5.chunk.js isn't that large? Does it show a different size in the treeview?

  2. th0r commented on Feb 14, 2019

    @th0r
    Contributor

    I think its a legit bug. I've overlooked this case.

  3. th0r commented on Feb 14, 2019

    @th0r
    Contributor

    @kyriiherman it's not so easy. What if the only found item is a directory? In your case the size will be zero.

  4. kyriiherman commented on Feb 14, 2019

    @kyriiherman
    Author

    @th0r yes, this is correct behavior. in your case the directory is empty, otherwise all files inside directory are present in found modules, because files paths include directory name

  5. th0r commented on Feb 14, 2019

    @th0r
    Contributor

    @kyriiherman No, it's not. You can input a regexp that will match only directory name e.g. node_modules$ and it won't be empty.

  6. kyriiherman commented on Feb 14, 2019

    @kyriiherman
    Author

    @th0r oh, my fault( so we should check for this.searchQueryRegexp and if someone is looking for a directory then we should consider directory size, otherwise no 😏I can submit a pull request.

  7. th0r commented on Feb 14, 2019

    @th0r
    Contributor

    I don't think it will work either. The proper solution would be to check nesting of the found items e.g. if we have found "lodash/find.js" module then we should ignore it's size if we also found a whole "lodash" directory. So this task is not so simple and may require quite significant changes in the data structure that currently represents modules tree.

  8. kyriiherman commented on Feb 15, 2019

    @kyriiherman
    Author

    @th0r why you think solution with checking this.searchQueryRegexp isn't ok?

  9. th0r commented on Feb 15, 2019

    @th0r
    Contributor

    @kyriiherman (lodash$)|(react) is a valid RegExp that will match both lodash folder and all the react folders and modules. core\.js$ can match both core.js folder and core.js module. RegExp can't tell you what user is looking for.

  10. kyriiherman commented on Feb 15, 2019

    @kyriiherman
    Author

    @th0r so we need to filter modules tree in foundModulesByChunk, but save its structure and then in foundModules use walkModules to convert modules tree into collection. with this approach we can use tree structure to count totalSize

  11. anatoliyarkhipov commented on Oct 25, 2019

    @anatoliyarkhipov

    Just to clarify, the problem is still here, right? If yes, what do you think about this regexp, do I get the real number this way? 🤔
    image

  12. valscion commented on Oct 25, 2019

    @valscion
    Collaborator

    Yes the problem is still there. I don't know the answer to your other question, maybe someone else knows.

  13. ppJuan commented on Jan 12, 2021

    @ppJuan

    same problem
    1610438777186-image

  14. added 2 commits that reference this issue on Oct 16, 2026
    3cafd1d
    cb1d322
  15. added a commit that references this issue on Oct 27, 2026
    077aa1f
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

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions