{"action":"opened","issue":{"url":"https://api.github.com/repos/pegjs/pegjs/issues/363","labels_url":"https://api.github.com/repos/pegjs/pegjs/issues/363/labels{/name}","comments_url":"https://api.github.com/repos/pegjs/pegjs/issues/363/comments","events_url":"https://api.github.com/repos/pegjs/pegjs/issues/363/events","html_url":"https://github.com/pegjs/pegjs/issues/363","id":100656546,"number":363,"title":"CommonJS `require(...)` statements fail if relative paths are used.","user":{"login":"jamestalmage","id":4082216,"avatar_url":"https://avatars.githubusercontent.com/u/4082216?v=3","gravatar_id":"","url":"https://api.github.com/users/jamestalmage","html_url":"https://github.com/jamestalmage","followers_url":"https://api.github.com/users/jamestalmage/followers","following_url":"https://api.github.com/users/jamestalmage/following{/other_user}","gists_url":"https://api.github.com/users/jamestalmage/gists{/gist_id}","starred_url":"https://api.github.com/users/jamestalmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamestalmage/subscriptions","organizations_url":"https://api.github.com/users/jamestalmage/orgs","repos_url":"https://api.github.com/users/jamestalmage/repos","events_url":"https://api.github.com/users/jamestalmage/events{/privacy}","received_events_url":"https://api.github.com/users/jamestalmage/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-12T23:27:37Z","updated_at":"2015-08-12T23:27:37Z","closed_at":null,"body":"Grammar:\r\n```js\r\n{\r\n  var helperModule = require('./helper-module');\r\n}\r\n\r\nStartRule = \r\n   // ...\r\n```\r\n\r\nBuild:\r\n```js\r\n  var parser = PEG.buildParser(grammarSource, {output: 'parser'});\r\n```\r\n\r\nIt will work if you do `{output: 'source'}` and write the output to a file in the same directory as the grammar (so that the relative path stays consistent).\r\n\r\nObviously this is due to the grammar source being `eval`ed in a completely different directory.\r\n\r\nIdeally, those paths would resolve relative to the location of the grammar file."}}