It’s easy to use an Node.js module that you have installed in your PebbleKit JS-enabled application:

  1. Install Browserify

    npm install -g browserify

  2. Require your favorite NPM packages and use:

     var xml2js = require('xml2js');
     Pebble.addEventListener("ready", function (e) {
       var xml = "Hello xml2js!"
       xml2js.parseString(xml, function (err, result) {
  3. Let Browserify compile all of your packages into a single file:

    browserify my-file.js -o pebble-js-app.js