{"action":"created","issue":{"url":"https://api.github.com/repos/zurb/foundation-sites/issues/10930","repository_url":"https://api.github.com/repos/zurb/foundation-sites","labels_url":"https://api.github.com/repos/zurb/foundation-sites/issues/10930/labels{/name}","comments_url":"https://api.github.com/repos/zurb/foundation-sites/issues/10930/comments","events_url":"https://api.github.com/repos/zurb/foundation-sites/issues/10930/events","html_url":"https://github.com/zurb/foundation-sites/pull/10930","id":296234997,"number":10930,"title":"fix: fix and re-enable plugins UMD module bundling","user":{"login":"ncoden","id":9939075,"avatar_url":"https://avatars2.githubusercontent.com/u/9939075?v=4","gravatar_id":"","url":"https://api.github.com/users/ncoden","html_url":"https://github.com/ncoden","followers_url":"https://api.github.com/users/ncoden/followers","following_url":"https://api.github.com/users/ncoden/following{/other_user}","gists_url":"https://api.github.com/users/ncoden/gists{/gist_id}","starred_url":"https://api.github.com/users/ncoden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncoden/subscriptions","organizations_url":"https://api.github.com/users/ncoden/orgs","repos_url":"https://api.github.com/users/ncoden/repos","events_url":"https://api.github.com/users/ncoden/events{/privacy}","received_events_url":"https://api.github.com/users/ncoden/received_events","type":"User","site_admin":false},"labels":[{"id":496475516,"url":"https://api.github.com/repos/zurb/foundation-sites/labels/build","name":"build","color":"fff3ce","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/zurb/foundation-sites/milestones/37","html_url":"https://github.com/zurb/foundation-sites/milestone/37","labels_url":"https://api.github.com/repos/zurb/foundation-sites/milestones/37/labels","id":3016543,"number":37,"title":"6.5.0","description":"Previously 6.4.4. Delayed to 6.5.0 to avoid any conflict with breaking changes introduces in 6.4.4-RC1.","creator":{"login":"ncoden","id":9939075,"avatar_url":"https://avatars2.githubusercontent.com/u/9939075?v=4","gravatar_id":"","url":"https://api.github.com/users/ncoden","html_url":"https://github.com/ncoden","followers_url":"https://api.github.com/users/ncoden/followers","following_url":"https://api.github.com/users/ncoden/following{/other_user}","gists_url":"https://api.github.com/users/ncoden/gists{/gist_id}","starred_url":"https://api.github.com/users/ncoden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncoden/subscriptions","organizations_url":"https://api.github.com/users/ncoden/orgs","repos_url":"https://api.github.com/users/ncoden/repos","events_url":"https://api.github.com/users/ncoden/events{/privacy}","received_events_url":"https://api.github.com/users/ncoden/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":25,"state":"open","created_at":"2018-01-06T13:09:40Z","updated_at":"2018-03-20T09:32:02Z","due_on":"2018-04-03T07:00:00Z","closed_at":null},"comments":14,"created_at":"2018-02-11T22:58:21Z","updated_at":"2018-03-21T04:09:21Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/zurb/foundation-sites/pulls/10930","html_url":"https://github.com/zurb/foundation-sites/pull/10930","diff_url":"https://github.com/zurb/foundation-sites/pull/10930.diff","patch_url":"https://github.com/zurb/foundation-sites/pull/10930.patch"},"body":"### Changes:\r\n* re-enable main/plugins entries bundling as UMD modules\r\n* bundle main/plugins entries in their own library for externals\r\n* export the mutated `Foundation` object and the plugin in every plugin entry\r\n\r\nFrom now, we use `__FOUNDATION_EXTERNALS__` in the global namespace for exported plugins. This is the only way I found to make UMD modules works with externals.\r\n\r\n### Explanation\r\n> So I was writting an issue to webpack, and explaining the problem helped me (as often) to understand what we're doing wrong.\r\n>\r\n> On one side, we want to use named export, so we see each plugin file not as the whole plugin, but as a container for the plugin.\r\n> On the other side, we want to import externals as the plugin itself (stocked in window.Foundation.*). > This was resolved by the externals: { './foundation.core': { Foundation: window.Foundation }, ...} trick because we were creating the \"container\" on the fly from (for this example) window.Foundation. But we cannot use that trick with UMD bundling.\r\n>\r\n> So: the solution is to bundle each generated file in its own webpack \"Library\": webpack embed all the file exports in a dedicated object. This is the container we want. So we use that \"Library\" for external instead of window.Foundation.*.\r\n> -- https://github.com/zurb/foundation-sites/pull/10903#issuecomment-364776349\r\n\r\n### Todo:\r\n- [x] Reduce namespace pollution\r\n- [x] Prevent `Foundation.Plugin` and `Foundation.Utils.core` to be duplicated across plugins\r\n\r\n### Note\r\nNote to myself: this PR made me better understanding how webpack and bundlers works, as well as different import and bundling methods and standards. Want go further the simple tutorials on the net? Assign yourself a difficult issue and learn things the hard way, inspecting your dependencies' source code and looking at how others projects solves this problem.\r\n\r\n### See also:\r\n* 🐞  Bug introduced in #10864\r\n* ◀️  Re-enable UMD from: #10911\r\n* ◀️  Previous PR: #10903 (dirty)"},"comment":{"url":"https://api.github.com/repos/zurb/foundation-sites/issues/comments/374829566","html_url":"https://github.com/zurb/foundation-sites/pull/10930#issuecomment-374829566","issue_url":"https://api.github.com/repos/zurb/foundation-sites/issues/10930","id":374829566,"user":{"login":"DanielRuf","id":827205,"avatar_url":"https://avatars1.githubusercontent.com/u/827205?v=4","gravatar_id":"","url":"https://api.github.com/users/DanielRuf","html_url":"https://github.com/DanielRuf","followers_url":"https://api.github.com/users/DanielRuf/followers","following_url":"https://api.github.com/users/DanielRuf/following{/other_user}","gists_url":"https://api.github.com/users/DanielRuf/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielRuf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielRuf/subscriptions","organizations_url":"https://api.github.com/users/DanielRuf/orgs","repos_url":"https://api.github.com/users/DanielRuf/repos","events_url":"https://api.github.com/users/DanielRuf/events{/privacy}","received_events_url":"https://api.github.com/users/DanielRuf/received_events","type":"User","site_admin":false},"created_at":"2018-03-21T04:09:21Z","updated_at":"2018-03-21T04:09:21Z","author_association":"COLLABORATOR","body":"> So now we can use ESM imports with the standard entry foundation.js I would go for the classic \"use the dist/entries files, don't touch the sources\" approach and remove these paragraphs from the docs. What do you say ?\r\n\r\nDefinitely. Go for it."}}
{"actor":{"display_login":"DanielRuf"}}