Nativescript 8: TNS_ENV is missing

16 Views Asked by At

In older Nativescript applications development environment was checked:

if (TNS_ENV !== 'production') {
  // app is running in development environment
}

This does not work in Nativescript 8. How development environment is checked in nativescript 8?

1

There are 1 best solutions below

0
Tola On

It seems there is variable called __DEV__ in nativescript 8.

TNS_ENV vas defined in old webpack config and webpack config has changed in nativescript 8. Docs mention magic variables and there is variable called __DEV__. New weback configuration is found here

So in Nativescript 8 development environment is checked:

if (__DEV__) {
  // app is running in development environment
}