Require is not defined

I’m using this

// Example requires the use of the 'request' library //

var request = require("request");
var token = 'API_TOKEN'

var options = {
  method: 'GET',
  url: '',
  headers: {
    'Authorization': 'Bearer ' + token,
    'Content-Type': 'application/json'

request(options, function(err, response, body) {
   if (err) throw new Error(err);

From the ionic api site:

But I get this error

ReferenceError: require is not defined ionic.bundle.js:26794

in the console. I’m running it on my phone and I’m using remote chrome debug for the console. I tried using requireJS but that did not much because that needs to get required too, so I dont get the point of that plugin.

why is this happening??