{"action":"opened","issue":{"url":"https://api.github.com/repos/jrburke/requirejs/issues/1290","labels_url":"https://api.github.com/repos/jrburke/requirejs/issues/1290/labels{/name}","comments_url":"https://api.github.com/repos/jrburke/requirejs/issues/1290/comments","events_url":"https://api.github.com/repos/jrburke/requirejs/issues/1290/events","html_url":"https://github.com/jrburke/requirejs/issues/1290","id":59444759,"number":1290,"title":"require sugar syntax does not work on ","user":{"login":"eleith","id":284832,"avatar_url":"https://avatars.githubusercontent.com/u/284832?v=3","gravatar_id":"","url":"https://api.github.com/users/eleith","html_url":"https://github.com/eleith","followers_url":"https://api.github.com/users/eleith/followers","following_url":"https://api.github.com/users/eleith/following{/other_user}","gists_url":"https://api.github.com/users/eleith/gists{/gist_id}","starred_url":"https://api.github.com/users/eleith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eleith/subscriptions","organizations_url":"https://api.github.com/users/eleith/orgs","repos_url":"https://api.github.com/users/eleith/repos","events_url":"https://api.github.com/users/eleith/events{/privacy}","received_events_url":"https://api.github.com/users/eleith/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-02T06:45:20Z","updated_at":"2015-03-02T06:45:20Z","closed_at":null,"body":"we hit the \"not loaded\" bug while using the sugar syntax recently in production, using our minified scripts. below is a boiled down sample to show how to reproduce the bug.\r\n\r\n```javascript\r\ndefine(function(require){function makeHttps(url){return url.replace(/^http:\\/\\//i,\"https://\")}var x=require(\"js/lib/x\");return{}});\r\n```\r\n\r\nwhen the script loads, require throws a \"no loaded\" error when it sees `js/lib/x`\r\n\r\nhowever if we were to do this instead:\r\n\r\n```javascript\r\ndefine(function(require){var x=require(\"js/lib/x\");function makeHttps(url){return url.replace(/^http:\\/\\//i,\"https://\")}return{}});\r\n```\r\n\r\n`js/lib/x` will load as expected and no error is thrown.\r\n\r\nthis is using requirejs 2.1.15\r\n\r\nas you can see, our minification moved all our require calls to the bottom. my guess is the parsing to figure out the dependencies of a script using the sugar syntax interacts incorrectly with the `makeHttps` regex parts."}}