{"action":"created","issue":{"url":"https://api.github.com/repos/twbs/bootstrap/issues/17201","labels_url":"https://api.github.com/repos/twbs/bootstrap/issues/17201/labels{/name}","comments_url":"https://api.github.com/repos/twbs/bootstrap/issues/17201/comments","events_url":"https://api.github.com/repos/twbs/bootstrap/issues/17201/events","html_url":"https://github.com/twbs/bootstrap/issues/17201","id":102324428,"number":17201,"title":"Treat jQuery as a dependency in ES6 source code","user":{"login":"vejersele","id":869669,"avatar_url":"https://avatars.githubusercontent.com/u/869669?v=3","gravatar_id":"","url":"https://api.github.com/users/vejersele","html_url":"https://github.com/vejersele","followers_url":"https://api.github.com/users/vejersele/followers","following_url":"https://api.github.com/users/vejersele/following{/other_user}","gists_url":"https://api.github.com/users/vejersele/gists{/gist_id}","starred_url":"https://api.github.com/users/vejersele/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vejersele/subscriptions","organizations_url":"https://api.github.com/users/vejersele/orgs","repos_url":"https://api.github.com/users/vejersele/repos","events_url":"https://api.github.com/users/vejersele/events{/privacy}","received_events_url":"https://api.github.com/users/vejersele/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/twbs/bootstrap/labels/js","name":"js","color":"ffc40d"},{"url":"https://api.github.com/repos/twbs/bootstrap/labels/v4","name":"v4","color":"563d7c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-08-21T08:20:46Z","updated_at":"2015-08-24T09:16:24Z","closed_at":null,"body":"First of all, congrats on the v4 release guys. Looking really nice! I'm especially excited about the new ES6 source code. However, when scanning the source code I noticed that jQuery isn't imported like the other dependencies. Because of this jQuery is also missing in the UMD definitions that are generated via grunt. This causes the UMD modules to be more or less unusable unless you include jQuery globally.\r\n\r\nI guess the reason for this is that it's probably difficult to guess how people are going to import jQuery. Import paths and package names may differ between package managers, etc ...\r\n\r\nHowever, since jQuery is the only external dependency here, I think it should be possible. For example you could ask people using requirejs to define a custom path, [which they are probably doing already](http://requirejs.org/docs/jquery.html) ... \r\n\r\nOn npm the package for jQuery is 'jquery', so this shouldn't cause any issues. Then the only remaining problem is that babel is converting this:\r\n\r\n```javascript\r\nimport $ from 'jquery'\r\n````\r\nto \r\n```javascript\r\nfactory(mod.exports, mod, global.$);\r\n```\r\nWhich probably will work, but it is kind of risky to use '$' instead of jQuery I guess ... Maybe there is way to hook into babel's compiling step and change module names there ... \r\n\r\nAdding jQuery as a dependency will also enable people who are already writing ES6 code to actually import the ES6 code ...\r\n\r\nI may be missing a lot of stuff here, so any feedback is more than welcome!\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/twbs/bootstrap/issues/comments/134106315","html_url":"https://github.com/twbs/bootstrap/issues/17201#issuecomment-134106315","issue_url":"https://api.github.com/repos/twbs/bootstrap/issues/17201","id":134106315,"user":{"login":"vejersele","id":869669,"avatar_url":"https://avatars.githubusercontent.com/u/869669?v=3","gravatar_id":"","url":"https://api.github.com/users/vejersele","html_url":"https://github.com/vejersele","followers_url":"https://api.github.com/users/vejersele/followers","following_url":"https://api.github.com/users/vejersele/following{/other_user}","gists_url":"https://api.github.com/users/vejersele/gists{/gist_id}","starred_url":"https://api.github.com/users/vejersele/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vejersele/subscriptions","organizations_url":"https://api.github.com/users/vejersele/orgs","repos_url":"https://api.github.com/users/vejersele/repos","events_url":"https://api.github.com/users/vejersele/events{/privacy}","received_events_url":"https://api.github.com/users/vejersele/received_events","type":"User","site_admin":false},"created_at":"2015-08-24T09:16:24Z","updated_at":"2015-08-24T09:16:24Z","body":"Small update:\r\n\r\nI was able to get it working just by adding import jQuery as jQuery to every JS file. If you're ok with it, I would suggest to run the unit tests directly on the UMD builds ... I see no need to compile a version without UMD definitions anymore ... \r\n\r\nOne thing I noticed though while testing this locally, is that there are some additional issues regarding the UMD builds ... I've created a separate [issue](https://github.com/twbs/bootstrap/issues/17265) for this.\r\n\r\nOnce I fixed these 2 problems I was able to successfully run unit tests against the UMD builds. If you want I can come up with a pull request. "}}