{"action":"created","issue":{"url":"https://api.github.com/repos/lodash/lodash/issues/223","labels_url":"https://api.github.com/repos/lodash/lodash/issues/223/labels{/name}","comments_url":"https://api.github.com/repos/lodash/lodash/issues/223/comments","events_url":"https://api.github.com/repos/lodash/lodash/issues/223/events","html_url":"https://github.com/lodash/lodash/issues/223","id":12611399,"number":223,"title":"Lodash doesn't work in Browserify","user":{"login":"SLaks","id":313894,"avatar_url":"https://avatars.githubusercontent.com/u/313894?v=3","gravatar_id":"","url":"https://api.github.com/users/SLaks","html_url":"https://github.com/SLaks","followers_url":"https://api.github.com/users/SLaks/followers","following_url":"https://api.github.com/users/SLaks/following{/other_user}","gists_url":"https://api.github.com/users/SLaks/gists{/gist_id}","starred_url":"https://api.github.com/users/SLaks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SLaks/subscriptions","organizations_url":"https://api.github.com/users/SLaks/orgs","repos_url":"https://api.github.com/users/SLaks/repos","events_url":"https://api.github.com/users/SLaks/events{/privacy}","received_events_url":"https://api.github.com/users/SLaks/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/lodash/lodash/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2013-03-29T17:05:49Z","updated_at":"2015-09-24T06:42:07Z","closed_at":"2013-03-30T01:27:52Z","body":"I installed lodash from npm (both 1.1.0 and 1.1.1 fail), and ran through Browserify v1.17.3, and I got an error about invoking an undefined function.\r\n\r\nThe problem comes from the following line (in `runInContext()`):\r\n\r\n    // Avoid issues with some ES3 environments that attempt to use values, named\r\n    // after built-in constructors like `Object`, for the creation of literals.\r\n    // ES5 clears this up by stating that literals must use built-in constructors.\r\n    // See http://es5.github.com/#x11.1.5.\r\n    context = context ? _.defaults(window.Object(), context, _.pick(window, contextProps)) : window;\r\n\r\n`window` is the outer `this` as passed to `(function (window) { ... }(this))`.  \r\nIn Browserify, `this` is `module.exports` (Browserify wraps lodash's source in its own function), which doesn't have any globals.  \r\nTherefore, lines like `context.Array()` fail."},"comment":{"url":"https://api.github.com/repos/lodash/lodash/issues/comments/142828100","html_url":"https://github.com/lodash/lodash/issues/223#issuecomment-142828100","issue_url":"https://api.github.com/repos/lodash/lodash/issues/223","id":142828100,"user":{"login":"ptarjan","id":40143,"avatar_url":"https://avatars.githubusercontent.com/u/40143?v=3","gravatar_id":"","url":"https://api.github.com/users/ptarjan","html_url":"https://github.com/ptarjan","followers_url":"https://api.github.com/users/ptarjan/followers","following_url":"https://api.github.com/users/ptarjan/following{/other_user}","gists_url":"https://api.github.com/users/ptarjan/gists{/gist_id}","starred_url":"https://api.github.com/users/ptarjan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ptarjan/subscriptions","organizations_url":"https://api.github.com/users/ptarjan/orgs","repos_url":"https://api.github.com/users/ptarjan/repos","events_url":"https://api.github.com/users/ptarjan/events{/privacy}","received_events_url":"https://api.github.com/users/ptarjan/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T06:42:07Z","updated_at":"2015-09-24T06:42:07Z","body":"@jdalton the repro is very simple:\r\n\r\n```\r\n$ cat a.js\r\nvar _ = require('lodash');\r\n$ browserify a.js > a.browserify.js\r\n$ v8 a.browserify.js\r\na.browserify.js:720: TypeError: Cannot read property 'prototype' of undefined\r\n    var arrayProto = Array.prototype,\r\n                          ^\r\nTypeError: Cannot read property 'prototype' of undefined\r\n    at runInContext (a.browserify.js:720:27)\r\n    at Object.<anonymous> (a.browserify.js:12322:11)\r\n    at Object.<anonymous> (a.browserify.js:12353:3)\r\n    at Object.1 (a.browserify.js:12355:4)\r\n    at s (a.browserify.js:1:254)\r\n    at a.browserify.js:1:305\r\n    at Object.2.lodash (a.browserify.js:12357:9)\r\n    at s (a.browserify.js:1:254)\r\n    at e (a.browserify.js:1:425)\r\n    at a.browserify.js:1:443"}}