You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
Recently, we moved to yarn workspace monorepo although I'm not sure if this is happening because of it since I haven't used the library in some time.
There lib is generating the bundle and sourcemap, but it seems to be corrupted.
Generating bundle...
warning: the transform cache was reset.
Welcome to Metro!
Fast - Scalable - Integrated
info Writing bundle output to:, /var/folders/z0/1fmtx0f56_z4f2mgch3tyfsm0000gn/T/react-native-bundle-visualizer/app/ios.bundle
info Writing sourcemap output to:, /var/folders/z0/1fmtx0f56_z4f2mgch3tyfsm0000gn/T/react-native-bundle-visualizer/app/ios.bundle.map
info Done writing bundle output
info Done writing sourcemap output
Bundle is 85.18 MB in size (unchanged since last run)
=== error === {
bundles: [],
errors: [
{
bundleName: '/var/folders/z0/1fmtx0f56_z4f2mgch3tyfsm0000gn/T/react-native-bundle-visualizer/app/ios.bundle',
code: 'InvalidMappingLine',
message: 'Your source map refers to generated line 17, but the source only contains 16 line(s).\n' +
'Check that you are using the correct source map.',
error: [AppError]
}
]
}
Reacted by Gaurav Singh, Kunal Phaltankar, Aravind Dammu, Denis Evgrafov, James Holcomb, Fedir Ushakov, Shahjahan, Adam Horodyski, David Leuliette, UraFIZ and 10 more
seen the same issue. RN 0.71.2 and react-native-bundle-visualizer 3.1.3
tried with 3.1.0 and have a different error message, so it seems there is a difference in behavior between 3.1.0 and 3.1.3:
node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^
[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<Object>".] {
code: 'ERR_UNHANDLED_REJECTION'
}
ok I see 3.1.3 is supposed to fix RN 0.71 compatibility, I guess this is why I had different behavior. unfortunately seems none version works for me.
@nicolasburtey Thanks for the repro. I briefly took a look at that and looks like it's probably related to how metro.config.js is overriden. I don't have a clear explanation of the issue yet, I will try to look for details. Probably this could be related but need to dig further. I also tried putting minifierPath to metro-minify-uglify but it doesn't seem to work.
Same here, no metro overrides, completely new project =(
Bundle is 4.75 MB in size (unchanged since last run)
=== error === {
bundles: [],
errors: [
{
bundleName: '/var/folders/24/31vn44z11c3b363x4p5pd6bw0000gp/T/react-native-bundle-visualizer/app/ios.bundle',
code: 'InvalidMappingLine',
message: 'Your source map refers to generated line 3, but the source only contains 2 line(s).\n' +
'Check that you are using the correct source map.',
error: [AppError]
}
]
}
Reacted by Kunal Phaltankar, Shahjahan, hjpark and risafj
The latest metro has a fix for this issue. see the linked PR on the above issue here (although I don't know what it means for in terms of a new release for this package)
@frankcalise thanks for the the comment. But I'm not sure I understand what should I do?
The branch #fix-set-minify-to-false doesn't exist anymore and my version of metro isn't using terser as a minifier
That fix was then updated in react-native-cli in 10.2.0 release here.
Finally, the react-native-cli was updated here in the latest react-native version i.e: 0.71.4
I need some confirmation from the community, does latest react-native 0.71.4 works for you with latest react-native-bundle-visualizer 3.1.3 ?
I tried on my system and it works without any fuss.
So I will wait until I get some confirmations if that's the case for others and then reverting the changes of setting minification to false in this PR, so that we benefit from minification while visualizing the bundles.
Reacted by Dan Ladendorf, Alon Ezer, Seph Soliman, tonymatheus and Pawara Siriwardhane
@hurali97 thanks for looking into it some, I am not sure if that's the only issue as it's stated it started w/ RN 70 version but at least in my case my project is still on RN 68. I was able to work around the issue though as noted in my previous comment above.
@scrungrth Okay, so 3.1.0 works for you on react-native 0.68 ? 🤔 So it's probably possible that 3.1.3 doesn't work for some folks and it's ideally safe to revert that change. Given that, if things work for you on 3.1.0, you should be good with the new release of this package which will revert the changes introduced in the last 3.1.3 release.
As far as I have researched and investigated minification changes by metro is the root cause of this issue and should be fine with latest RN but let's see.
after running this : npx react-native-bundle-visualizer --platform android
Generating bundle...
Welcome to Metro v0.80.9
Fast - Scalable - Integrated
info Writing bundle output to:, /var/folders/f3/nd_q0dz1475_r3z6hbmh_3zh0000gp/T/react-native-bundle-visualizer/AwesomeProject/android.bundle
info Writing sourcemap output to:, /var/folders/f3/nd_q0dz1475_r3z6hbmh_3zh0000gp/T/react-native-bundle-visualizer/AwesomeProject/android.bundle.map
info Done writing bundle output
info Done writing sourcemap output
Bundle is 8.85 MB in size (unchanged since last run)
=== error === {
bundles: [],
errors: [
{
bundleName: '/var/folders/f3/nd_q0dz1475_r3z6hbmh_3zh0000gp/T/react-native-bundle-visualizer/AwesomeProject/android.bundle',
code: 'InvalidMappingColumn',
message: 'Your source map refers to generated column 6 on line 11, but the source only contains 4 column(s) on that line.\n' +
'Check that you are using the correct source map.',
error: [AppError]
}
]
}
error with 0.73.8
=== error === {
bundles: [],
errors: [
{
bundleName: '/var/folders/n6/zp9z88mj2033bf9t_z5tx3qh0000gn/T/react-native-bundle-visualizer/caresm/ios.bundle',
code: 'InvalidMappingColumn',
message: 'Your source map refers to generated column 40 on line 6, but the source only contains 38 column(s) on that line.\n' +
'Check that you are using the correct source map.',
error: [AppError]
}
]
}
It would appear that source-map-explorer is miscalculating the EOL character.
Instead of detecting \n in React Native's JavaScript bundle, it instead detected \r\n, meaning the number of lines in the bundle were underestimated. This longstanding issue is documented more thoroughly here.
Applying the following hack to node_modules/source-map-explorer/lib/explore.js appears to resolve the issue:
same error === error === {
bundles: [],
errors: [
{
bundleName: '/var/folders/6b/p3mmjslj43v_p9jwgxpp00_80000gp/T/react-native-bundle-visualizer/ztokydcim/ios.bundle',
code: 'InvalidMappingColumn',
message: 'Your source map refers to generated column 50 on line 41, but the source only contains 45 column(s) on that line.\n' +
'Check that you are using the correct source map.',
error: [AppError]
}
]
It would appear that source-map-explorer is miscalculating the EOL character.
Instead of detecting \n in React Native's JavaScript bundle, it instead detected \r\n, meaning the number of lines in the bundle were underestimated. This longstanding issue is documented more thoroughly here.
Applying the following hack to node_modules/source-map-explorer/lib/explore.js appears to resolve the issue:
combining this with the EOL fix makes my tree map at least have my src folder included (as opposed to having none)
around 19% still unmaped though 😞
Edit: btw, I was curious about which parts of the sources where referencing \r\n, so I added a dump (fs.writeFileSync('dump.txt', fileContent.replaceAll('\r\n','\r\n-MARKER-R-N-'))) to that calculate part and checked.. there's a lot of license comments using that EOL 😞
=== error === {
bundles: [],
errors: [
{
bundleName: '/var/folders/pc/cb7cs0td4gzf_f8wv47m5ww80000gq/T/react-native-bundle-visualizer/repomobile/ios.bundle',
code: 'InvalidMappingColumn',
message: 'Your source map refers to generated column 141 on line 176, but the source only contains 140 column(s) on that line.\n' +
'Check that you are using the correct source map.',
error: [AppError]
}
]
}
I tried to change the version + "react-native-bundle-visualizer": "3.1.3",
To
+ "react-native-bundle-visualizer": "3.1.0",
but not worked
So I tried and it worked
return explore(
{
code: bundleOutput,
map: bundleOutputSourceMap
},
{
onlyMapped,
noBorderChecks: true, // <----------- Add this line
output: {
format,
filename: bundleOutputExplorerFile,
},
}
);
It worked but still unable to map 17.70% ,I will try to fix it
Activity
JHeigle commentedon Feb 16, 2023
Same here. Tried downgrading, but made no difference. Haven't been able to find a solution for this one.
scrungrth commentedon Feb 16, 2023
I installed this version as a dev dependency, and ran locally to fix
+ "react-native-bundle-visualizer": "3.1.0",hurali97 commentedon Feb 17, 2023
@JHeigle @gabimoncha Can you guys tell are you using react-native cli or expo? Also the react-native-bundle-visualizer version that is being used.
nicolasburtey commentedon Feb 19, 2023
seen the same issue. RN 0.71.2 and react-native-bundle-visualizer 3.1.3
tried with 3.1.0 and have a different error message, so it seems there is a difference in behavior between 3.1.0 and 3.1.3:
ok I see 3.1.3 is supposed to fix RN 0.71 compatibility, I guess this is why I had different behavior. unfortunately seems none version works for me.
@hurali97 related repo if you want to try locally: https://github.com/GaloyMoney/galoy-mobile
hurali97 commentedon Feb 19, 2023
@nicolasburtey Thanks for the repro. I briefly took a look at that and looks like it's probably related to how
metro.config.jsis overriden. I don't have a clear explanation of the issue yet, I will try to look for details. Probably this could be related but need to dig further. I also tried putting minifierPath tometro-minify-uglifybut it doesn't seem to work.I will try to comeback soon with an update. 👍
arif-dewi commentedon Feb 23, 2023
Same here, no metro overrides, completely new project =(
gabimoncha commentedon Feb 24, 2023
Not working
gabimoncha commentedon Feb 24, 2023
I'm using react-native-cli and
"react-native-bundle-visualizer": "^3.1.3"frankcalise commentedon Mar 8, 2023
This is probably related to this: #116
Try this temp fix: #116 (comment)
The latest metro has a fix for this issue. see the linked PR on the above issue here (although I don't know what it means for in terms of a new release for this package)
gabimoncha commentedon Mar 13, 2023
@frankcalise thanks for the the comment. But I'm not sure I understand what should I do?
The branch
#fix-set-minify-to-falsedoesn't exist anymore and my version of metro isn't usingterseras a minifierhurali97 commentedon Mar 14, 2023
Hey folks,
Sorry for not being active. But I think I can devote some time to it now. I will be testing this on:
Let's see how far do I get in terms of investigating and then getting it fixed 🤞
hurali97 commentedon Mar 14, 2023
Hi guys,
I have a few comments to discuss:
I need some confirmation from the community, does latest
react-native 0.71.4works for you with latestreact-native-bundle-visualizer 3.1.3?I tried on my system and it works without any fuss.
So I will wait until I get some confirmations if that's the case for others and then reverting the changes of setting minification to false in this PR, so that we benefit from minification while visualizing the bundles.
scrungrth commentedon Mar 14, 2023
@hurali97 thanks for looking into it some, I am not sure if that's the only issue as it's stated it started w/ RN 70 version but at least in my case my project is still on RN 68. I was able to work around the issue though as noted in my previous comment above.
hurali97 commentedon Mar 15, 2023
@scrungrth Okay, so 3.1.0 works for you on react-native 0.68 ? 🤔 So it's probably possible that 3.1.3 doesn't work for some folks and it's ideally safe to revert that change. Given that, if things work for you on 3.1.0, you should be good with the new release of this package which will revert the changes introduced in the last 3.1.3 release.
As far as I have researched and investigated minification changes by metro is the root cause of this issue and should be fine with latest RN but let's see.
gabimoncha commentedon Mar 21, 2023
I confirm that 3.1.0 is working for 0.67.5 too
23 remaining items
kangfenmao commentedon May 14, 2024
npx source-map-explorer ios.bundle --no-border-checks
pot2mayo commentedon May 14, 2024
@kangfenmao
It worked, thanks 👍🏼
sayan-avantai commentedon Jun 17, 2024
nothing worked for me.
"react-native": "0.74.2",
devDependencies
"react-native-bundle-visualizer": "^3.1.3",
after running this : npx react-native-bundle-visualizer --platform android
Generating bundle...
Welcome to Metro v0.80.9
Fast - Scalable - Integrated
info Writing bundle output to:, /var/folders/f3/nd_q0dz1475_r3z6hbmh_3zh0000gp/T/react-native-bundle-visualizer/AwesomeProject/android.bundle
info Writing sourcemap output to:, /var/folders/f3/nd_q0dz1475_r3z6hbmh_3zh0000gp/T/react-native-bundle-visualizer/AwesomeProject/android.bundle.map
info Done writing bundle output
info Done writing sourcemap output
Bundle is 8.85 MB in size (unchanged since last run)
=== error === {
bundles: [],
errors: [
{
bundleName: '/var/folders/f3/nd_q0dz1475_r3z6hbmh_3zh0000gp/T/react-native-bundle-visualizer/AwesomeProject/android.bundle',
code: 'InvalidMappingColumn',
message: 'Your source map refers to generated column 6 on line 11, but the source only contains 4 column(s) on that line.\n' +
'Check that you are using the correct source map.',
error: [AppError]
}
]
}
devtyty commentedon Jun 18, 2024
Error with react-native 0.73.8
vksgautam1 commentedon Jul 9, 2024
error with 0.73.8
=== error === {
bundles: [],
errors: [
{
bundleName: '/var/folders/n6/zp9z88mj2033bf9t_z5tx3qh0000gn/T/react-native-bundle-visualizer/caresm/ios.bundle',
code: 'InvalidMappingColumn',
message: 'Your source map refers to generated column 40 on line 6, but the source only contains 38 column(s) on that line.\n' +
'Check that you are using the correct source map.',
error: [AppError]
}
]
}
Jahanzeb009 commentedon Jul 17, 2024
Works but empty tree map on 0.74.3
kpose commentedon Jul 23, 2024
Works but empty tree map on 0.74.1
Unable to map 22108684/23290850 bytes (94.92%)chen834921478 commentedon Sep 19, 2024
这样之后我这里运行起来了
cawfree commentedon Oct 18, 2024
It would appear that
source-map-exploreris miscalculating the EOL character.Instead of detecting
\nin React Native's JavaScript bundle, it instead detected\r\n, meaning the number of lines in the bundle were underestimated. This longstanding issue is documented more thoroughly here.Applying the following hack to
node_modules/source-map-explorer/lib/explore.jsappears to resolve the issue:function computeFileSizes(sourceMapData, options, coverageRanges) { const { consumer, codeFileContent: fileContent } = sourceMapData; const sourceMapComment = getSourceMapComment(fileContent); const sourceContent = fileContent.replace(sourceMapComment, '').trim(); - const eol = helpers_1.detectEOL(fileContent); + const eol = '\n';//helpers_1.detectEOL(fileContent); const lines = sourceContent.split(eol);This allows exploration of a generated bundle source map to complete without enabling
noBorderChecks.kingjack commentedon Oct 19, 2024
same error === error === {
bundles: [],
errors: [
{
bundleName: '/var/folders/6b/p3mmjslj43v_p9jwgxpp00_80000gp/T/react-native-bundle-visualizer/ztokydcim/ios.bundle',
code: 'InvalidMappingColumn',
message: 'Your source map refers to generated column 50 on line 41, but the source only contains 45 column(s) on that line.\n' +
'Check that you are using the correct source map.',
error: [AppError]
}
]
freeboub commentedon Oct 26, 2024
I confirm this is fixing the error, Thank you very much !
Grohden commentedon Nov 15, 2024
combining this with the EOL fix makes my tree map at least have my src folder included (as opposed to having none)
around 19% still unmaped though 😞
Edit: btw, I was curious about which parts of the sources where referencing
\r\n, so I added a dump (fs.writeFileSync('dump.txt', fileContent.replaceAll('\r\n','\r\n-MARKER-R-N-'))) to that calculate part and checked.. there's a lot of license comments using that EOL 😞Abhijeet92-hub commentedon Jul 19, 2025
I am facing same issue
I tried to change the version
+ "react-native-bundle-visualizer": "3.1.3",To
+ "react-native-bundle-visualizer": "3.1.0",but not worked
So I tried and it worked
It worked but still unable to map 17.70% ,I will try to fix it
retyui commentedon Mar 18, 2026
Hey all, this issue was fixed in 3.2.0