javascript - Using Node package in NativeScript app -


i learning nativescript. example, include guid generator package in nativescript app. question is, how? @ directory structure generated command-line tool , see following relevant pieces:

node_modules app   tns_modules   package.json package.json   

do add node-uuid ./package.json or ./app/package.json? how reference in app then? example, if want use uuid app.js file, like? i'm little confused because of package structure of nativescript , how things loaded @ runtime.

thanks

run npm install root of {n} app.

npm install --save node-uuid 

the dependency added outer package.json.

and in app.js file, use usual.

var uuid = require('node-uuid');  

when run tns run <platform> or tns build <platform>, modules inside node_modules/ copied folder under platforms/, take android example, @ platforms/android/assets/app/tns_modules/node-uuid. building process completed under platforms/ directory.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -