Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it / will it be possible to dynamically load modules from URIs? #4

Open
cristiano-belloni opened this issue May 30, 2013 · 2 comments

Comments

@cristiano-belloni
Copy link

The question can be rephrased as: will you ever implement a loader in Sheperd? Be it a watered-down Harmony modules loader or something fancy like this pseudocode:

var modules = [name: 'plugin_one', url: 'http://example.com/plugin_one.js',
                       name: 'plugin_two', url: 'http://example.com/plugin_two.js'];

for (var i = 0; i < modules.length; i+=1) {
    var module_obj  = module(modules[i].name).at(modules[i].url);
    // The modules have a common interface and will export the function doSomething
    module_obj.doSomething ();
}
@xcambar
Copy link
Owner

xcambar commented Jun 12, 2013

It's already possible when you run Shepherd from a Node.js environment, see https://github.com/xcambar/shepherd-js/blob/master/test/spec/nodeJSSpec.js#L58

In the browser, it requires a lot more work to do it securely.

@guybedford
Copy link

@xcambar I'm wondering what you are referring to here about security.

I have implemented an XHR & eval-based approach to the loader polyfill here - https://github.com/guybedford/es6-loader. I'd be interested to hear your thoughts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants