I’m using visual studio as IDE and was struggling with debugging for a while but I just got my environment working as I want.
Or if you don’t use an IDE with IntelliSense for TypeScript you could always place a good old debugger statement inside your code. If on execution you hit that specific piece of code, the debugger will stop there
How is this solution affected by the fact that Webpack is no longer used in the Ionic 2 build process? Still struggling to get debugging Typescript working properly. I feel like debugging is such a key part of development that making it easy (and having all of this set up by default) should be a high priority for the Ionic team – at the very least maintaining documentation on how to enable source maps in every version of Ionic 2 with Typescript.
Not a whole lot of insight yet. I’ve been relying on command line feedback from the build process to isolate typescript errors and then I use chrome debugging with a live device for general script stuff. Involves a lot of console logs.
One frustrating thing is that a large part of my app is reliant on a 3rd-party cordova plug-in, which means that I can really only test on the device, even for simple things. It’s frustrating to have to do a build for every small change I want to test. I tried --livereload on the build process, but that doesn’t seem to do anything when I write changes to .ts files (or even .js files) for that matter. Not sure what the development workflow is supposed to be on that one.
Let me know if you have any ideas/successes with debugging – I’m still definitely looking for answers.
It is in fact difficult to debug ionic, especially on device (ios for sure, safari is not that good), so I rely on a LogService that I created (where I can switch on/off for production) and log anything that is worth logging.
If there are issues, errors… I then try to locate the log value and to isolate the problem by logging more in that special area of code…
ionic serve with chrome is nice tho, but in the end you have to test your app on a device…
One question is – has anyone gotten the “source maps” workflow to work with RC2? I have sourcemaps enabled but don’t really know how to get it working with chrome, and don’t know if it will work at all with a live device, so I’ve delayed putting in the effort…
Can you describe more about your “LogService”? How do you set it up? I tend to just pepper my code with console.log() statements and then comment some out when I’ve solved a problem, leave others that provide useful (but not overwhelming) feedback.
Its simply a injectable component/service and by using that, i call
logService.log whenever i need to.
In the Service or in appsettings i Set enableLog to true, when going
Production to false… more kb in the end but I do not habe to remove every
console.log when going productive.
Additionally, I use it to Log errors and i Send them to a Server…