Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova hook not running when using modules.exports function

I created an after_prepare hook :

#!/usr/bin/env node

module.exports = function(context) {
    ... some code
  console.log('Hey, a hook');
}

When I run cordova build android, I see in the terminal that it says it is running my hook but it seems like it's not running the module.exports function, because the console.log isn't shown in the console.

like image 862
Sn0opr Avatar asked May 24 '16 10:05

Sn0opr


1 Answers

I solved this!

I added hook to the config.xml file

<hook type="after_prepare" src="hooks/after_prepare/020_add_android_permissions.js"/>

and now it executes the code under the module.exports function.

Update: here is the working example

like image 94
likerRr Avatar answered Oct 23 '22 04:10

likerRr