Skip to content

Commit 4e6fe44

Browse files
authored
Release v4 (#140)
- Node.js `20+` - Removed `fs-extra` - Use `node:` imports - Update dependencies - Update README.md
1 parent f8a535c commit 4e6fe44

File tree

5 files changed

+304
-169
lines changed

5 files changed

+304
-169
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
# [3.2.0](https://github.com/IjzerenHein/react-native-bundle-visualizer/releases/tag/v3.2.0) (2026-03-18)
1+
# [4.0.0](https://github.com/callstack/react-native-bundle-visualizer/releases/tag/v3.2.0) (2026-03-19)
2+
3+
**Breaking change:**
4+
- Node.js `20+`
5+
- Expo SDK `50+`
6+
- React Native `0.72.x+`
7+
- `fs-extra` was replaced with build-in `fs` module
8+
- Update dependencies to their latest versions
9+
10+
# [3.2.0](https://github.com/callstack/react-native-bundle-visualizer/releases/tag/v3.2.0) (2026-03-18)
211

312
- Fixes [Your source map refers to generated line 17, but the source only contains 15 line(s). Check that you are using the correct source map](https://github.com/callstack/react-native-bundle-visualizer/issues/127) disable border checks by default since all Modern React Native versions generate source maps with some invalid mappings. You can re-enable these checks by passing the `--border-checks` flag.
413

README.md

Lines changed: 68 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,45 @@
11
# react-native-bundle-visualizer
22

3-
See what's inside of your react-native bundle 📦
3+
[![react-native-bundle-visualizer on npm](https://badgen.net/npm/v/react-native-bundle-visualizer)](https://www.npmjs.com/package/react-native-bundle-visualizer)
4+
[![react-native-bundle-visualizer downloads](https://badgen.net/npm/dm/react-native-bundle-visualizer)](https://www.npmtrends.com/react-native-bundle-visualizer)
5+
[![react-native-bundle-visualizer install size](https://packagephobia.com/badge?p=react-native-bundle-visualizer)](https://packagephobia.com/result?p=react-native-bundle-visualizer)
6+
[![CI status](https://github.com/callstack/react-native-bundle-visualizer/actions/workflows/test.yml/badge.svg)](https://github.com/callstack/react-native-bundle-visualizer/actions/workflows/test.yml)
7+
8+
9+
See what's inside your react-native bundle 📦
410

511
![bundle-visualizer-animation](./react-native-bundle-visualizer2.gif)
612

713
Uses the awesome [source-map-explorer](https://github.com/danvk/source-map-explorer) to visualize the output of the [Metro bundler](https://github.com/facebook/metro).
814

915
## Purpose
1016

11-
Sometimes, importing a single javascript library can drastically increase your bundle size. This package helps you to identify such a library, so you can keep the bundle size low and loading times fast.
17+
Sometimes, importing a single JavaScript library can drastically increase your bundle size. This package helps you to identify such a library, so you can keep the bundle size low and loading times fast.
1218

1319
## Usage
1420

15-
Make sure [npx](https://github.com/npm/npx) is installed and run the following command in your project root
16-
17-
`npx react-native-bundle-visualizer`
18-
19-
### Or install as a dev-dependency
21+
Using `npx` is the recommended way to run the visualizer
2022

2123
```sh
22-
yarn add --dev react-native-bundle-visualizer
24+
# React Native 0.72+
25+
npx react-native-bundle-visualizer@latest
26+
# or Expo SDK 50+
27+
npx react-native-bundle-visualizer@latest --expo
2328
```
2429

25-
And run it:
30+
### Or you can install as a dev-dependency
2631

27-
```
28-
yarn run react-native-bundle-visualizer
32+
```sh
33+
yarn add --dev react-native-bundle-visualizer
34+
# or npm
35+
npm install --save-dev react-native-bundle-visualizer
2936
```
3037

31-
_or when using npm:_
38+
To run the local version of visualizer, use the following command:
3239

33-
```
34-
npm install --save-dev react-native-bundle-visualizer ./node_modules/.bin/react-native-bundle-visualizer
40+
```sh
41+
npx react-native-bundle-visualizer # if installed by yarn or npm
42+
yarn run react-native-bundle-visualizer # if installed by Yarn
3543
```
3644

3745
## Command line arguments
@@ -53,16 +61,57 @@ All command-line arguments are optional. By default a production build will be c
5361

5462
[smeo]: https://github.com/danvk/source-map-explorer#options
5563

56-
> Use [react-native-bundle-visualizer@2](https://github.com/IjzerenHein/react-native-bundle-visualizer/tree/v2) when targetting Expo SDK 40 or lower.
64+
65+
## Common questions
66+
67+
#### 1. What version of React Native and Expo is supported?
68+
69+
See the [version compatibility](#version-compatibility) table below.
70+
71+
#### 2. What does `[unmapped]` represent?
72+
73+
`[unmapped]` is code in a final bundle without mapping to original source code (usually generated by bundlers: Webpack, Metro, Babel)
74+
75+
You can [open your source maps online](https://evanw.github.io/source-map-visualization) and check it
76+
77+
See example (red borders is unmapped code):
78+
79+
![](https://github.com/user-attachments/assets/9f0d095f-336e-4bda-af67-b0df09d3a5fb)
80+
81+
#### 3. What alternatives I can use to inspect my bundle?
82+
83+
See the [similar projects](#similar-projects) section below for alternatives to this package.
84+
85+
#### 4. `InvalidMappingColumn` error
86+
87+
> example: Your source map refers to generated column Infinity on line 2, but the source only contains 2075 column(s) on that line
88+
89+
if you faced this error, try to run the visualizer with `--no-border-checks` flag to disable invalid mapping column/line checks.
90+
91+
92+
## Similar projects
93+
94+
You can use then following alternatives:
95+
96+
- [expo-atlas](https://github.com/expo/atlas) [![expo-atlas downloads](https://badgen.net/npm/dm/expo-atlas)](https://www.npmtrends.com/expo-atlas) [![expo-atlas install size](https://packagephobia.com/badge?p=expo-atlas)](https://packagephobia.com/result?p=expo-atlas)
97+
- [expo-atlas-without-expo](https://github.com/v3ron/expo-atlas-without-expo) [![expo-atlas-without-expo downloads](https://badgen.net/npm/dm/expo-atlas-without-expo)](https://www.npmtrends.com/expo-atlas-without-expo) [![expo-atlas-without-expo install size](https://packagephobia.com/badge?p=expo-atlas-without-expo)](https://packagephobia.com/result?p=expo-atlas-without-expo)
98+
- [react-native-bundle-visualizer](https://github.com/callstack/react-native-bundle-visualizer) [![react-native-bundle-visualizer downloads](https://badgen.net/npm/dm/react-native-bundle-visualizer)](https://www.npmtrends.com/react-native-bundle-visualizer)[![react-native-bundle-visualizer install size](https://packagephobia.com/badge?p=react-native-bundle-visualizer)](https://packagephobia.com/result?p=react-native-bundle-visualizer)
99+
- [react-native-bundle-discovery](https://github.com/retyui/react-native-bundle-discovery) [![react-native-bundle-discovery downloads](https://badgen.net/npm/dm/react-native-bundle-discovery)](https://www.npmtrends.com/react-native-bundle-discovery) [![react-native-bundle-discovery install size](https://packagephobia.com/badge?p=react-native-bundle-discovery)](https://packagephobia.com/result?p=react-native-bundle-discovery)
100+
- [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) [![webpack-bundle-analyzer downloads](https://badgen.net/npm/dm/webpack-bundle-analyzer)](https://www.npmtrends.com/webpack-bundle-analyzer)[![webpack-bundle-analyzer install size](https://packagephobia.com/badge?p=webpack-bundle-analyzer)](https://packagephobia.com/result?p=webpack-bundle-analyzer)
101+
- [bundle-stats](https://github.com/relative-ci/bundle-stats/tree/master/packages/cli#readme) [![bundle-stats downloads](https://badgen.net/npm/dm/bundle-stats)](https://www.npmtrends.com/bundle-stats)[![bundle-stats install size](https://packagephobia.com/badge?p=bundle-stats)](https://packagephobia.com/result?p=bundle-stats)
102+
- [statoscope](https://github.com/statoscope/statoscope) [![@statoscope/cli downloads](https://badgen.net/npm/dm/@statoscope/cli)](https://www.npmtrends.com/@statoscope/cli)[![@statoscope/cli install size](https://packagephobia.com/badge?p=@statoscope/cli)](https://packagephobia.com/result?p=@statoscope/cli)
103+
57104

58105
## Version compatibility
59106

60-
| Version | Comments |
61-
| ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
62-
| 3.x | Compatible with React-Native CLI bootstrapped projects and Expo SDK 41 or higher. |
63-
| [2.x](https://github.com/IjzerenHein/react-native-bundle-visualizer/tree/v2) | Compatible with React-Native CLI bootstrapped projects and Expo SDK 40 or earlier. |
107+
| Version | Comments |
108+
|------------------------------------------------------------------------------|------------------------------------------------------------------|
109+
| 4.x | Compatible with React Native 0.72+ or Expo SDK 50+ (Node.js 20+) |
110+
| [3.x](https://github.com/IjzerenHein/react-native-bundle-visualizer/tree/v3) | Compatible with React-Native CLI bootstrapped projects and Expo SDK 41 or higher. |
111+
| [2.x](https://github.com/IjzerenHein/react-native-bundle-visualizer/tree/v2) | Compatible with React-Native CLI bootstrapped projects and Expo SDK 40 or earlier. |
64112
| [1.x](https://github.com/IjzerenHein/react-native-bundle-visualizer/tree/v1) | Uses the [Haul bundler](https://github.com/callstack/haul) instead instead of the Metro output. |
65113

114+
66115
## License
67116

68117
[MIT](./LICENSE.txt)

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-bundle-visualizer",
3-
"version": "3.2.0",
3+
"version": "4.0.0",
44
"description": "See what's inside your react-native bundle",
55
"author": "IjzerenHein <hrutjes@gmail.com>",
66
"keywords": [
@@ -22,15 +22,17 @@
2222
],
2323
"dependencies": {
2424
"chalk": "^4.1.2",
25-
"execa": "^5.1.1",
26-
"fs-extra": "^10.0.0",
27-
"minimist": "^1.2.5",
28-
"open": "^8.4.0",
25+
"execa": "^9.6.1",
26+
"minimist": "^1.2.8",
27+
"open": "^11.0.0",
2928
"source-map-explorer": "^2.5.3"
3029
},
3130
"scripts": {
3231
"test": "yarn test:rn && yarn test:expo",
3332
"test:rn": "cd test/RN64 && yarn install && npx ../.. && cd ../..",
3433
"test:expo": "cd test/Expo42 && yarn install && npx ../.. --expo=true && cd ../.."
34+
},
35+
"engines": {
36+
"node": ">=20"
3537
}
3638
}

src/react-native-bundle-visualizer.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env node
2+
const fs = require('node:fs');
3+
const os = require('node:os');
4+
const process = require('node:process');
5+
const path = require('node:path');
26
const chalk = require('chalk');
3-
const fs = require('fs-extra');
4-
const os = require('os');
5-
const process = require('process');
6-
const path = require('path');
77
const argv = require('minimist')(process.argv.slice(2));
8-
const execa = require('execa');
9-
const open = require('open');
8+
const {execa} = require('execa');
9+
const open = require('open').default;
1010
const {explore} = require('source-map-explorer');
1111
const pkgJSON = JSON.parse(fs.readFileSync('./package.json'));
1212

@@ -74,8 +74,8 @@ const borderChecks = argv['border-checks'] === true;
7474
const errorOnFail = argv['error-on-fail'] || false;
7575

7676
// Make sure the temp dir exists
77-
fs.ensureDirSync(baseDir);
78-
fs.ensureDirSync(tmpDir);
77+
fs.mkdirSync(baseDir, { recursive: true });
78+
fs.mkdirSync(tmpDir, { recursive: true });
7979

8080
// Try to obtain the previous file size
8181
let prevBundleSize;
@@ -162,14 +162,15 @@ bundlePromise
162162
);
163163

164164
// Make sure the explorer output dir is removed
165-
fs.removeSync(outDir);
165+
fs.rmSync(outDir, { recursive: true, force: true });
166166
return explore(
167167
{
168168
code: bundleOutput,
169169
map: bundleOutputSourceMap,
170170
},
171171
{
172172
onlyMapped,
173+
noRoot: false,
173174
noBorderChecks: borderChecks === false,
174175
output: {
175176
format,

0 commit comments

Comments
 (0)