{"action":"closed","issue":{"url":"https://api.github.com/repos/thlorenz/browserify-ftw/issues/18","labels_url":"https://api.github.com/repos/thlorenz/browserify-ftw/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/thlorenz/browserify-ftw/issues/18/comments","events_url":"https://api.github.com/repos/thlorenz/browserify-ftw/issues/18/events","html_url":"https://github.com/thlorenz/browserify-ftw/issues/18","id":73280492,"number":18,"title":"A module without a dependency crashes the build script in with style = 'comma'","user":{"login":"godspeedelbow","id":1466424,"avatar_url":"https://avatars.githubusercontent.com/u/1466424?v=3","gravatar_id":"","url":"https://api.github.com/users/godspeedelbow","html_url":"https://github.com/godspeedelbow","followers_url":"https://api.github.com/users/godspeedelbow/followers","following_url":"https://api.github.com/users/godspeedelbow/following{/other_user}","gists_url":"https://api.github.com/users/godspeedelbow/gists{/gist_id}","starred_url":"https://api.github.com/users/godspeedelbow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/godspeedelbow/subscriptions","organizations_url":"https://api.github.com/users/godspeedelbow/orgs","repos_url":"https://api.github.com/users/godspeedelbow/repos","events_url":"https://api.github.com/users/godspeedelbow/events{/privacy}","received_events_url":"https://api.github.com/users/godspeedelbow/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/thlorenz/browserify-ftw/labels/awaiting%20response","name":"awaiting response","color":"fbca04"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-05T10:53:46Z","updated_at":"2015-07-28T20:55:52Z","closed_at":"2015-07-28T20:55:52Z","body":"Hi,\r\n\r\nWhen a module requires no other module, like this:\r\n```\r\ndefine(function(require){\r\n    return 'nothing';\r\n});\r\n```\r\n\r\nand I set the `style` option to `'comma'` in the refactor config, I get this error\r\n\r\n```\r\nstream.js:94\r\n      throw er; // Unhandled stream error in pipe.\r\n            ^\r\nTypeError: Cannot read property 'length' of undefined\r\n    at generateHead (/usr/local/lib/node_modules/browserify-ftw/lib/requirefy.js:83:49)\r\n```\r\n\r\nIn `lib/requirefy.js:83`, I changed:\r\n```js\r\nhead[head.length - 1] = str.slice(0, str.length - 1) + ';';\r\n```\r\n\r\ninto\r\n\r\n```js\r\nif (head.length) {\r\n  head[head.length - 1] = str.slice(0, str.length - 1) + ';';\r\n}\r\n```\r\n\r\nThat fixes it, but there might be other implications I am not aware of."}}