JonnyBurger / npx-visualize-bundle

Analyse your React Native bundle in 1 command
https://npmjs.com/package/visualize-bundle
MIT License
162 stars 8 forks source link

Uncaught TypeError: Cannot read property 'dom' of undefined #8

Closed slavikdenis closed 5 years ago

slavikdenis commented 5 years ago

While trying to run npx visualize-bundle -a -d -o ./, I'm running into an issue on the generated html file Uncaught TypeError: Cannot read property 'dom' of undefined.

If you need any more details on this issue, please let me know. Thanks

image

JonnyBurger commented 5 years ago

Thanks for filing the issue!

Can you try to feed the result into https://www.npmjs.com/package/source-map-explorer directly and see if the this might be a bug in source-map-explorer?

Alternatively it could be the -o flag. Does the problem remain if you remove it?

slavikdenis commented 5 years ago

Removing the -o flag does not help.


After saving the bundle from http://localhost:8081/index.bundle?platform=android&sourceMap=true&dev=true&minify=false&hot=false as bundle.js and the source map from http://localhost:8081/index.map?platform=android&sourceMap=true&dev=true&minify=false&hot=false as bundle.js.map , I had to edit the raw bundle last line from //# sourceMappingURL=http://localhost:8081/index.map?platform=android&sourceMap=true&dev=true&minify=false&hot=false to //# sourceMappingURL=bundle.js.map.

After I ran npx source-map-explorer bundle.js{,.map} and only after these steps I successfully generated the report.

image

Not completely sure if these are the standard steps to succeed tho :D

JonnyBurger commented 5 years ago

Hi Denis!

Thanks that is very helpful! While I do not experience the error, I have made a PR here: #9

Could you check out this PR and try to see if it works? You can start the tool locally just with npm install followed by npm start.

slavikdenis commented 5 years ago

Unfortunatly the prepare script is failing for me probably because I'm on windows and tsc && echo "#! /usr/bin/env node" | cat - dist/index.js > /tmp/out && mv /tmp/out dist/index.js is not cross-platform.

I will look into the solution for windows later and let you know.

slavikdenis commented 5 years ago

@JonnyBurger sorry for the delay. I just tried out your PR but unfortunately without success :/ Do not worry to close this issue and reopen it when someone else runs into this issue as well.

JonnyBurger commented 5 years ago

Thanks for getting back! If somebody has more info please comment here 😊