Skip to content

ReferenceError: require is not defined #7

@yocontra

Description

@yocontra
var obj = {
  fn: function(url, cb) {
    require('http').get({
      host: url
    }, cb);
  }
};
var str = JASON.stringify(obj);
console.log(str);
var newobj = JASON.parse(str);

yields

{"fn":(function (url, cb) {
          require('http').get({
            host: url
          }, cb);
        })}

undefined:2
          require('http').get({
          ^
ReferenceError: require is not defined
    at eval at parse (/home/codex/apps/thread/node_modules/JASON/index.js:276:12)

I read the README section about this and it says items in the global scope (like require) should work. Am I doing something wrong here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions