-
We talked about modules exporting their objects, rather than tacking them onto some global namespace object (
window.Ember
) as a side effect of loading the module. Do we have any nice patterns to translate a modules that register stuff (e.g. https://github.com/SlexAxton/require-handlebars-plugin/blob/master/demo/template/helpers/yeller.js) into a side-effect-free syntax? -
Let's assume module "foo" registers something global as a side effect. Do I read http://wiki.ecmascript.org/doku.php?id=harmony:modules#external_module_load correctly that
import "foo"
will not only fetch "foo" at compile time, but also run the "foo" module at run time, if it hasn't already run? (So any global side effects will have happened afterimport "foo"
.) -
Rails auto-loads all my Ruby files. That's super-convenient. Also for JavaScript, the Rails asset pipeline not only has
//= require foo
(which becomesimport "foo"
), but//= require_tree .
. Obviously there is no 1:1 equivalent forrequire_tree
, but do we have any kind of strategy/story for this?
Last active
December 18, 2015 14:49
-
-
Save joliss/5799831 to your computer and use it in GitHub Desktop.
@joliss i have had success making the resolver module aware. This prevents lots of the extra import boiler plate in large apps.
Just had a conversation with Stefan. Summary re the questions in this gist:
- Handlebars templates might look up the helper on the container, which in turn can automatically load the module. (There's probably still some stuff to be figured out, but it's a first step.)
- Still waiting for @wycats on this one.
- It seems that in a lot of cases we can go without auto-loading everything (like Rails does), without having imports all over the place. And in cases where we do need to load things, perhaps the build tool can help.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@wycats Any ideas? ^