Creates app/environment.json
from the nativescript-cli command via argv --env.app
tns plugin add nativescript-app-environment
-
Set production mode in tns run:
tns run android --env.app.prod
This will create
environment.json
with this content:{ prod: true }
-
in app
const { environment } = require('./environment.json'); console.log(environment);
-
Inspired by nativescript-hook-debug-production