{"action":"closed","issue":{"url":"https://api.github.com/repos/codemirror/CodeMirror/issues/3447","labels_url":"https://api.github.com/repos/codemirror/CodeMirror/issues/3447/labels{/name}","comments_url":"https://api.github.com/repos/codemirror/CodeMirror/issues/3447/comments","events_url":"https://api.github.com/repos/codemirror/CodeMirror/issues/3447/events","html_url":"https://github.com/codemirror/CodeMirror/issues/3447","id":100350619,"number":3447,"title":"diff_match_patch is not a constructor when using Require.js","user":{"login":"clintmilner","id":361105,"avatar_url":"https://avatars.githubusercontent.com/u/361105?v=3","gravatar_id":"","url":"https://api.github.com/users/clintmilner","html_url":"https://github.com/clintmilner","followers_url":"https://api.github.com/users/clintmilner/followers","following_url":"https://api.github.com/users/clintmilner/following{/other_user}","gists_url":"https://api.github.com/users/clintmilner/gists{/gist_id}","starred_url":"https://api.github.com/users/clintmilner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clintmilner/subscriptions","organizations_url":"https://api.github.com/users/clintmilner/orgs","repos_url":"https://api.github.com/users/clintmilner/repos","events_url":"https://api.github.com/users/clintmilner/events{/privacy}","received_events_url":"https://api.github.com/users/clintmilner/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-11T16:19:06Z","updated_at":"2015-08-12T08:34:53Z","closed_at":"2015-08-12T08:34:53Z","body":"I have a project using Require.js (ver 2.1.18) where I'm using CodeMirror (ver 5.5.1) to view/edit a JavaScript file in the browser (this and all CodeMirror addons work as expected).\r\n\r\nI now need to show any diffs in the file, so I've been trying to implement the merge.js addon, but having troubles with the diff_match_patch.js lib that is also required.\r\n```javascript\r\n// Firebug + Firefox 39.0.3\r\n// merge.js\r\n// (line 550, col 12)\r\n\"TypeError: diff_match_patch is not a constructor\r\nvar dmp = new diff_match_patch();\"\r\n```\r\n```\r\n// Chrome Version 44.0.2403.130 (64-bit)\r\n// merge.js (551)\r\n\"Uncaught TypeError: diff_match_patch is not a function\"\r\n```\r\n\r\nI can see that diff_match_patch.js is being loaded by Require, but when passed to that function in merge.js, the JavaScript error breaks the page. The Merge view doesn't show.\r\nChanging the line \r\n``` \r\nvar dmp = new diff_match_patch();\r\n``` \r\nto\r\n```\r\nvar dmp = diff_match_patch;\r\n```\r\nallows the 2 views to render, but the dmp.diff_main map is not created."}}