{"action":"created","issue":{"url":"https://api.github.com/repos/moment/moment/issues/2736","repository_url":"https://api.github.com/repos/moment/moment","labels_url":"https://api.github.com/repos/moment/moment/issues/2736/labels{/name}","comments_url":"https://api.github.com/repos/moment/moment/issues/2736/comments","events_url":"https://api.github.com/repos/moment/moment/issues/2736/events","html_url":"https://github.com/moment/moment/issues/2736","id":115765213,"number":2736,"title":"Loading moment twice discards extensions","user":{"login":"TimvdLippe","id":5948271,"avatar_url":"https://avatars.githubusercontent.com/u/5948271?v=3","gravatar_id":"","url":"https://api.github.com/users/TimvdLippe","html_url":"https://github.com/TimvdLippe","followers_url":"https://api.github.com/users/TimvdLippe/followers","following_url":"https://api.github.com/users/TimvdLippe/following{/other_user}","gists_url":"https://api.github.com/users/TimvdLippe/gists{/gist_id}","starred_url":"https://api.github.com/users/TimvdLippe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimvdLippe/subscriptions","organizations_url":"https://api.github.com/users/TimvdLippe/orgs","repos_url":"https://api.github.com/users/TimvdLippe/repos","events_url":"https://api.github.com/users/TimvdLippe/events{/privacy}","received_events_url":"https://api.github.com/users/TimvdLippe/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/moment/moment/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/moment/moment/labels/Troubleshooting","name":"Troubleshooting","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-11-08T22:11:26Z","updated_at":"2016-04-01T18:50:13Z","closed_at":null,"body":"Consider the following use-case:\r\n\r\n1. Project loads `moment`\r\n2. Project loads an extension (for example https://github.com/moment/moment-timezone)\r\n3. Project loads another dependency which loads `moment`\r\n\r\nThis causes the extension to be discarded, as moment is redefined. Trying to use the extension causes `moment.extension is undefined`-error.\r\n\r\n**Expected behaviour**\r\nWhen moment loads, it checks if it is already loaded. If it is already loaded, it returns silently. Resulting extensions to remain defined and usable.\r\n\r\n**Proposed fix**\r\n```javascript\r\nif (global.moment !== undefined) {\r\n  // Moment is already loaded, don't redefine\r\n  return;\r\n}\r\n```\r\n\r\nI think this should be inserted before https://github.com/moment/moment/blob/develop/moment.js#L8"},"comment":{"url":"https://api.github.com/repos/moment/moment/issues/comments/204519317","html_url":"https://github.com/moment/moment/issues/2736#issuecomment-204519317","issue_url":"https://api.github.com/repos/moment/moment/issues/2736","id":204519317,"user":{"login":"icambron","id":244988,"avatar_url":"https://avatars.githubusercontent.com/u/244988?v=3","gravatar_id":"","url":"https://api.github.com/users/icambron","html_url":"https://github.com/icambron","followers_url":"https://api.github.com/users/icambron/followers","following_url":"https://api.github.com/users/icambron/following{/other_user}","gists_url":"https://api.github.com/users/icambron/gists{/gist_id}","starred_url":"https://api.github.com/users/icambron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icambron/subscriptions","organizations_url":"https://api.github.com/users/icambron/orgs","repos_url":"https://api.github.com/users/icambron/repos","events_url":"https://api.github.com/users/icambron/events{/privacy}","received_events_url":"https://api.github.com/users/icambron/received_events","type":"User","site_admin":false},"created_at":"2016-04-01T18:50:13Z","updated_at":"2016-04-01T18:50:13Z","body":"What environment is this? i.e. what are you using to load Moment?"}}