{"action":"created","issue":{"url":"https://api.github.com/repos/meteor/meteor/issues/4310","labels_url":"https://api.github.com/repos/meteor/meteor/issues/4310/labels{/name}","comments_url":"https://api.github.com/repos/meteor/meteor/issues/4310/comments","events_url":"https://api.github.com/repos/meteor/meteor/issues/4310/events","html_url":"https://github.com/meteor/meteor/issues/4310","id":72363758,"number":4310,"title":"Module system in Meteor.","user":{"login":"trusktr","id":297678,"avatar_url":"https://avatars.githubusercontent.com/u/297678?v=3","gravatar_id":"","url":"https://api.github.com/users/trusktr","html_url":"https://github.com/trusktr","followers_url":"https://api.github.com/users/trusktr/followers","following_url":"https://api.github.com/users/trusktr/following{/other_user}","gists_url":"https://api.github.com/users/trusktr/gists{/gist_id}","starred_url":"https://api.github.com/users/trusktr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trusktr/subscriptions","organizations_url":"https://api.github.com/users/trusktr/orgs","repos_url":"https://api.github.com/users/trusktr/repos","events_url":"https://api.github.com/users/trusktr/events{/privacy}","received_events_url":"https://api.github.com/users/trusktr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/meteor/meteor/labels/feature","name":"feature","color":"02d7e1"},{"url":"https://api.github.com/repos/meteor/meteor/labels/Project:Isobuild","name":"Project:Isobuild","color":"f7c6c7"}],"state":"open","locked":false,"assignee":{"login":"benjamn","id":5750,"avatar_url":"https://avatars.githubusercontent.com/u/5750?v=3","gravatar_id":"","url":"https://api.github.com/users/benjamn","html_url":"https://github.com/benjamn","followers_url":"https://api.github.com/users/benjamn/followers","following_url":"https://api.github.com/users/benjamn/following{/other_user}","gists_url":"https://api.github.com/users/benjamn/gists{/gist_id}","starred_url":"https://api.github.com/users/benjamn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjamn/subscriptions","organizations_url":"https://api.github.com/users/benjamn/orgs","repos_url":"https://api.github.com/users/benjamn/repos","events_url":"https://api.github.com/users/benjamn/events{/privacy}","received_events_url":"https://api.github.com/users/benjamn/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2015-05-01T06:05:05Z","updated_at":"2015-05-12T07:11:48Z","closed_at":null,"body":"Is there any plan to have a module system for Meteor (ES6 Modules perhaps)?\r\n\r\nI'm using Webpack to make bundles (one can be made for the server and one for the client). Each bundle can `require`/ or `import` common things used on both sides. It works nicely...\r\n\r\nBut problems can arise when (for example) a webpack bundle needs to depend on an Atmosphere package's globally exposed API, and that API depends on another Atmosphere package that contains an external non-Meteor library that the initial webpack bundle depends on too, causing duplicate code to exist in the app: one in the webpack bundle, and one in an Atmosphere package. For example, a library I'm using in my webpack bundle depends on [Famous](https://www.npmjs.com/package/famous) from npmjs.com, while a library I need from Atmosphere depends on [raix:famono](https://atmospherejs.com/raix/famono) which supplies a global version of Famous, so I have two Famous libraries in my app, which can lead to unexpected things happening because two sets of code that depend on Famous both want to use a Famous `Engine`, but there's no out of the box way for them to share the same `Engine`. A quick solution would be to port the Atmosphere package depending on raix:famono to npm, depend on Famous from npm instead of raix:famono, then I can use that library in my webpack bundle and there will be a single Famous `Engine` in the app.\r\n\r\nIt can be harder for large teams in large organizations to adopt Meteor for projects that are projected to be big because it doesn't have a module system (where modules with file-level scopes can export things that *aren't* put in global scope and other file-level scopes can import those things directly) in a world where the best tools outside of Meteor (webpack, browserify, etc) already have this (CommonJS for importing and exporting things at first, but AMD/ES6 with extensions to the tools).\r\n\r\nImagine what happens when a Meteor app gets huge, with hundreds of thousands of lines of code. The largest Meteor app I've seen in person was 12,000 lines and I could already see the complications.\r\n\r\nGalaxy will scale application bandwidth, but we also need something that scales developer productivity in a standard way that the whole rest of the JavaScript community uses (CJS and now ES6 Modules, goodbye AMD). Meteor's packaging system is evolving aside from the JavaScript community's overall standard instead of working with it.\r\n\r\n**Is Meteor's packaging system made so that beginners can get started quickly?** It's obvious that adding packages to a Meteor app and having things exposed in global scope makes it easy for novices to just start writing code (perhaps spaghetti code). This problem can be solved by simply telling people to make two entry points, one for server, one for client, and for common code to be put in a third place to be imported by either of the two sides. The tutorial can briefly explain how to import and export things from modules.\r\n\r\n**Is Meteor's packaging system designed to hook people into the Meteor ecosystem?** Building packages strictly for Atmosphere means that the those packages can't easily be used elsewhere. This might be good because it means people will be dedicated to their Meteor-only packages and more likely to stay in the Meteor community! But! It might also mean that some people simply won't jump into the ship!"},"comment":{"url":"https://api.github.com/repos/meteor/meteor/issues/comments/101162592","html_url":"https://github.com/meteor/meteor/issues/4310#issuecomment-101162592","issue_url":"https://api.github.com/repos/meteor/meteor/issues/4310","id":101162592,"user":{"login":"trusktr","id":297678,"avatar_url":"https://avatars.githubusercontent.com/u/297678?v=3","gravatar_id":"","url":"https://api.github.com/users/trusktr","html_url":"https://github.com/trusktr","followers_url":"https://api.github.com/users/trusktr/followers","following_url":"https://api.github.com/users/trusktr/following{/other_user}","gists_url":"https://api.github.com/users/trusktr/gists{/gist_id}","starred_url":"https://api.github.com/users/trusktr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trusktr/subscriptions","organizations_url":"https://api.github.com/users/trusktr/orgs","repos_url":"https://api.github.com/users/trusktr/repos","events_url":"https://api.github.com/users/trusktr/events{/privacy}","received_events_url":"https://api.github.com/users/trusktr/received_events","type":"User","site_admin":false},"created_at":"2015-05-12T07:11:48Z","updated_at":"2015-05-12T07:11:48Z","body":"@benjamn To test it out run this Meteor app where rocket-module is a locally installed and two other local packages depend on it: https://github.com/trusktr/meteor-with-webpack"}}