{"action":"created","issue":{"url":"https://api.github.com/repos/gopherjs/gopherjs/issues/524","repository_url":"https://api.github.com/repos/gopherjs/gopherjs","labels_url":"https://api.github.com/repos/gopherjs/gopherjs/issues/524/labels{/name}","comments_url":"https://api.github.com/repos/gopherjs/gopherjs/issues/524/comments","events_url":"https://api.github.com/repos/gopherjs/gopherjs/issues/524/events","html_url":"https://github.com/gopherjs/gopherjs/issues/524","id":178421890,"number":524,"title":"Proposal: add option to build browserify / es6 modules","user":{"login":"paralin","id":534887,"avatar_url":"https://avatars.githubusercontent.com/u/534887?v=3","gravatar_id":"","url":"https://api.github.com/users/paralin","html_url":"https://github.com/paralin","followers_url":"https://api.github.com/users/paralin/followers","following_url":"https://api.github.com/users/paralin/following{/other_user}","gists_url":"https://api.github.com/users/paralin/gists{/gist_id}","starred_url":"https://api.github.com/users/paralin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paralin/subscriptions","organizations_url":"https://api.github.com/users/paralin/orgs","repos_url":"https://api.github.com/users/paralin/repos","events_url":"https://api.github.com/users/paralin/events{/privacy}","received_events_url":"https://api.github.com/users/paralin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/gopherjs/gopherjs/labels/Proposal","name":"Proposal","color":"e6e6e6"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-09-21T18:10:15Z","updated_at":"2016-09-22T08:17:58Z","closed_at":null,"body":"I'm interested in having Gopherjs produce rather than a single javascript file, multiple files - one for each Go package. This would provide huge benefits to those of us using a modern modular workflow for building apps, as tools like Webpack could better understand the relationships between the different pieces of code in the output JavaScript, and re-compile only the packages that change when bundling after a `gopherjs build`.\r\n\r\nCurrently in the output code, each Go package is set as a property on `$packages`. In a modular output, each Go package could go into its own file, and use `module.exports` to export what would have been set on $packages before. Then, code that previously would do something like `$packages[\"github.com/gopherjs/js\"]` could instead do `require(\"./github.com/gopherjs/js\")`. The output code tree could just match the names of the packages. A common package could be referenced for all of the common code that ends up at the beginning of the output file right now.\r\n\r\nIs this something that would be feasible to implement in GopherJS?"},"comment":{"url":"https://api.github.com/repos/gopherjs/gopherjs/issues/comments/248839904","html_url":"https://github.com/gopherjs/gopherjs/issues/524#issuecomment-248839904","issue_url":"https://api.github.com/repos/gopherjs/gopherjs/issues/524","id":248839904,"user":{"login":"flimzy","id":8555063,"avatar_url":"https://avatars.githubusercontent.com/u/8555063?v=3","gravatar_id":"","url":"https://api.github.com/users/flimzy","html_url":"https://github.com/flimzy","followers_url":"https://api.github.com/users/flimzy/followers","following_url":"https://api.github.com/users/flimzy/following{/other_user}","gists_url":"https://api.github.com/users/flimzy/gists{/gist_id}","starred_url":"https://api.github.com/users/flimzy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flimzy/subscriptions","organizations_url":"https://api.github.com/users/flimzy/orgs","repos_url":"https://api.github.com/users/flimzy/repos","events_url":"https://api.github.com/users/flimzy/events{/privacy}","received_events_url":"https://api.github.com/users/flimzy/received_events","type":"User","site_admin":false},"created_at":"2016-09-22T08:17:58Z","updated_at":"2016-09-22T08:17:58Z","body":"> > A common package could be referenced for all of the common code that ends up at the beginning of the output file right now.\r\n\r\n> Right now DCE occurs based on the command being compiled. It may import io and only use certain things from there.\r\n\r\nI expect DCE would have to be turned off for any packages built this way.\r\n\r\nIf this feature is to be implemented, perhaps it makes sense to allow compilation of specific packages this way with a command-line flag which *also* disables DCE for that package.  This way one could compile `io` without DCE, but other packages could be DCEd and bundled together with `main.js`.\r\n\r\nThen we still need some way to tell GopherJS that the `main.js` build should exclude `io`.  I'm not sure how that would look/work.\r\n"}}
{"actor":{"display_login":"flimzy"}}