1 Reply Latest reply on Apr 3, 2016 6:59 PM by eric_yuan

    How to require my own app.js file in XDK

    eric_yuan

      Hey guys,

       

      Do you know how to add my own app.js file into main.js. so that i can invoke some function from app.js to main.js

      Just like a include file in C. We have a app.h and app.c ,then we can include"app.h" in main.c. so that we can invoke the function in main.c

       

      I followed an instruction and find out there is a error while compile it.

      /************************************/

      in app.js

      var app= function()

      {

           //do something here

      };

      module.exports = app;

      /*****************************************/

      in main.js

      var app= require('app.js')

      function loop()

      {

           //do something here.

      }



      There is a error says cannot find out the module of app.js.

      I was wondering whether i need to modify something in package.json?