Can't debug an emulated Ionic app - minified code

Can't debug an emulated Ionic app - minified code



Running this command...


ionic cordova emulate android



Problem is when debugging, all the code is minified (vendor.js and main.js) - hard to debug.



How do I get around this? I'd like to see both as my vendor.js is throwing an error. I'm sure there's an Ionic setting to stop this, but I checked the docs and did many searches, couldn't find anything.



Version is Ionic 3.



Ionic info contents...


Ionic:

ionic (Ionic CLI) : 4.1.2 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.0

Cordova:

cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.1.0
Cordova Plugins : cordova-plugin-ionic 4.2.0, cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.1.3, (and 16 other plugins)

System:

NodeJS : v10.10.0 (/usr/local/Cellar/node/10.10.0/bin/node)
npm : 6.4.1
OS : macOS High Sierra



Thanks!




2 Answers
2



Dos you try to search the file you wanna debug in the source tab in chrome devtools while you run ionic serve. It generally appears inside the src folder and then put the breakpoint or also you can put the word debugger in your code and it will stop your code there thats is how i do it.


debugger






Unfortunately sourcemaps are not available, so all I see is the minified code. Trying to debug that is not possible. Thanks though.

– Patrick
Sep 9 '18 at 9:32



Option 1:
Run with the --livereload parameter. I've found that using live reload provides sourcemaps when doing remote debugging more consistently than without live reload.


--livereload



Option 2:
Add below to your package.json file. That also works for me. Not sure if this will impact prod builds or not, so you may want to only use this one when actively debugging.


"config":
"ionic_bundler": "webpack",
"ionic_source_map_type": "#inline-source-map"






Yes, that does work, but I find the live reload to be pretty unstable - usually has issues for me communicating with the local dev machine. Hoping to get it working without live reload. However , for the sake of anyone else who stumbles on to this question and has no issues with --livereload, this DOES work, Thanks BRass.

– Patrick
Sep 10 '18 at 20:13







I added a non --livereload option that has worked for me too.

– BRass
Sep 10 '18 at 22:05


--livereload



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)