Skip to content

Mapping whole computer #35

Closed
Closed

Description

@gabimoncha

I've used yarn run react-native-bundle-visualizer inside the project's folder, but it logged the entire computer.

Screenshot 2020-09-03 at 19 13 04

Activity

  1. voxspox commented on Dec 15, 2020

    @voxspox

    +1 same behaviour here. Where is the unmapped part coming from?

  2. dogabudak commented on Dec 29, 2020

    @dogabudak

    +1 Same here, and is this tool actually giving me the true bundle size, or just downloaded node_module sizes. Because I remove some of the unused packages before i build the the App but they are actually still under node_modules but that doesn't mean that is my actual bundle size after compile. This is kinda miss leading if that is the case ?

  3. retyui commented on Mar 18, 2026

    @retyui
    Contributor

    It's a source-map-explorer bug and can be fixed by this patch:

    diff --git a/node_modules/source-map-explorer/lib/explore.js b/node_modules/source-map-explorer/lib/explore.js
    index d04fa30..4bea57b 100644
    --- a/node_modules/source-map-explorer/lib/explore.js
    +++ b/node_modules/source-map-explorer/lib/explore.js
    @@ -209,7 +209,7 @@ function computeFileSizes(sourceMapData, options, coverageRanges) {
     }
     function adjustSourcePaths(fileSizeMap, options) {
       if (!options.noRoot) {
    -    const prefix = helpers_1.getCommonPathPrefix(Object.keys(fileSizeMap));
    +    const prefix = helpers_1.getCommonPathPrefix(Object.keys(fileSizeMap).filter(e => !(e.startsWith('[') && e.endsWith(']'))));
         const length = prefix.length;
         if (length) {
           fileSizeMap = lodash_1.mapKeys(fileSizeMap, (size, source) => source.slice(length));

    (optional) if you are using 3.x version: add noRoot: false in node_modules/react-native-bundle-visualizer/src/react-native-bundle-visualizer.js file

          return explore(
            {
              code: bundleOutput,
              map: bundleOutputSourceMap,
            },
            {
              onlyMapped,
    +         noRoot: false,
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions