NativeScript (+TypeScript) conditional compilation / debug / release, etc


Hi all,

I’ve been playing around with NativeScript + TypeScript (but no Angular) for a few months now.

I was wondering about conditional compilation, differentiating between debug and release builds, platform defines that one can check against, etc.

TypeScript doesn’t seem to support conditional compilation (yet), which I find very strange. I think most compiled languages support this, so why not TypeScript… (but that’s obviously not NativeScript’s fault).

How do you all handle this? Are there plugins, hooks, whatever that deal with this?


Me :slight_smile:


I’m on the same boat. With Cordova / Ionic we would do something like

gulp watch --env=dev

Is there something like that for TS / NS?


You could check out nativescript-debug-production by @markosko, see if that doesn’t help your needs.

tns plugin add nativescript-hook-debug-production


I’ll check it, thanks!


Thanks for the tip :slight_smile: