Modules structure and ES6 import


#1

Where can I learn about Ember module structure in order to be able to selectively import only needed functions? For example it seems to be possible to do something like import { computed } from 'ember', but it’s not. And from 'ember-metal/computed' doesn’t work either. Thanks!


#2

I do not know what the plan for Ember.JS and ES6 module granularity is in the future, but currently you get a global export default Ember object that you have to deal with, on the top level. Inside Ember.JS is already finer grained, for instance see

https://github.com/emberjs/ember.js/blob/stable/packages/ember-metal/lib/computed.js#L641-L645


#3

Thank you for your reply! So basically I don’t have an access to other packages that are used in Ember internally and eventually exposed under Ember namespace? I thought that from the point view of transpiller these all are packages and you just have to know the path to access exported properties of each package. I’m not very familiar with JS and ES6 in particular so I failed the attempt to found a solution by reading Ember sources.


#4

Everything is exposed via the Ember namespace, yes. Stick to the official guides and API, the source code maybe too confusing (sorry about that, but it is often worth hunting for comments and inspiration there).

http://emberjs.com/api/modules/ember-metal.html

FYI: String is an extended prototype, RSVP is the external promise polyfill thing (I guess), RoutingService is private.