Closed bennlich closed 8 years ago
Yes the wiki page is old. But System.import certainly exists, we use it in our code and tests.
A couple things you can try: paste the error you see, and console.log('System', System);
just before you use System.import()
Here are the results:
@mariusnita tipped me off that manually adding
window.System = new traceur.runtime.BrowserTraceurLoader();
seems to fix this (and it does).
Somewhat aside: do you have to use System.import
if you want to turn on experimental features?
Our internal boot-up creates a System object w/o the standard functions. So you need to instantiate the full Loader as we do here https://github.com/google/traceur-compiler/blob/master/demo/repl.html#L50 and here https://github.com/google/traceur-compiler/blob/42c43262c1687d44f9db38a351cbde9201625f9a/src/browser/System.js#L17
I don't think the wiki page is erroneous, at least on this point. Although System
may become part of the standard JS runtime eventually, it's still sadly up in the air. And in any case we are moving towards separating the compiler and runtime. I guess we could add System to the bootstrap.js code.
For the browser, yes, import()
is how we set the options. There are open bugs on allowing options to be set via script-tag attributes. Another alternative is to recompile the compiler with new options.
Okay, awesome. Thanks for this. Maybe I should add a quick line to the Options in the browser section about creating System
? It seems weird that I'd be the only one running into this.
For what it's worth, I just ran into this as well @bennlich. An extra line of clarification would have been very much appreciated.
K. Added.
Definitely seems a little more obvious; thanks!
Hey, there! I've been successfully using traceur as documented here (more or less) like so:
Then I wanted to turn on some experimental features, so I tried following the instructions here, using
instead of
But
System.import
apparently doesn't exist? Is the above-linked wiki page old?I realize that System.js includes a
System
withSystem.import
, but surely there's a way to stick to traceur pure and simple?