Reputation: 3583
I have a Cordova project I am working on that uses broswerify so I can use require()
in the mobile app. Everything works good so I am attempting to move the browserifying of my js files to a Cordova hook so I don't have to remember to run browserify before installing the app.
Now when I move the command to browserify my js files to a Cordova hook (before_run), it has to be run twice before I see the changes I made.
cordova run...
. Hook runs successfully and app installs.cordova run...
again and now I see the new code in the bundle.js in the Android device.I'm thinking it may be a timing issue, if that is the case how do I make the Cordova hook wait until the bundle.js file is ready before continuing? If its something else can someone point me in the right direction to get this to work properly? I have tried this about 5 times and every time it does not work the first time but does work the 2nd time.
Upvotes: 0
Views: 200
Reputation: 5022
Make the hook script run sync for example using an npm script then have a bat or bash script that runs npm
npm run build
Upvotes: 0