On 24 May 2013 22:28, Joe Wood <[email protected]> wrote:
> As the implementation currently stands, does the harmony support in v8
> extend to loading modules in a different file statically?
> Does V8 depend on a application supplied module loader?
>
> I'm trying this:
>
> in external.js
>
> module external {
>     var x = 10;
>     export function gotit() { return x++; }
> }

First a small comment: If you wanted to import this file as a module
then it should not itself contain a module declaration, but only a
module body.

That being said, the implementation of modules in V8 has been put on
hold last year after the proposal had started to undergo significant
changes. In particular, module loaders have not been implemented yet.
Consequently, importing from external files does not work either.

There is a lot of other things that do not properly work for now. It's
basically work in progress. In general, I would not recommend using
modules yet.

> Then in sample.js, I try to import it - I've tried lots of different
> syntaxes, none seem to work:
>
> import external at 'file:///external.js';
> order.Price = external.gotit();
>
> I want to be able to load the sample.js script, and the V8 script object
> should import and resolve external.js which resides in the same directory.

Unfortunately, the ability to import from URLs or file paths will
probably be removed from the language.

/Andreas

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to