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

import fails in browser #2059

Open
davie opened this issue Jan 6, 2016 · 3 comments
Open

import fails in browser #2059

davie opened this issue Jan 6, 2016 · 3 comments

Comments

@davie
Copy link

davie commented Jan 6, 2016

We've been using traceur (on the fly in browser) for a while, but a recent change seems to have stopped modules being imported.
We're doing the same as the example on https://github.com/google/traceur-compiler/wiki/Getting-Started#a-touch-of-class

<script src="https://google.github.io/traceur-compiler/bin/traceur.js"></script>
<script src="https://google.github.io/traceur-compiler/src/bootstrap.js"></script>
<script type="module">
  import "myModule.js";
</script>

importing a module now fails with the following error:

ReferenceError: System is not defined
    at BrowserTraceurLoader.$__super.normalize (http://google.github.io/traceur-compiler/bin/traceur.js:32280:48)
    at InternalLoader.getOrCreateCodeUnit_ (http://google.github.io/traceur-compiler/bin/traceur.js:31942:43)
    at http://google.github.io/traceur-compiler/bin/traceur.js:32000:26
    at Array.map (native)
    at InternalLoader.handleCodeUnitLoaded (http://google.github.io/traceur-compiler/bin/traceur.js:31999:52)
    at InternalLoader.module (http://google.github.io/traceur-compiler/bin/traceur.js:31904:14)
    at BrowserTraceurLoader.Loader.module (http://google.github.io/traceur-compiler/bin/traceur.js:32163:37)
    at WebPageTranscoder.addFileFromScriptElement (http://google.github.io/traceur-compiler/bin/traceur.js:32534:39)
    at WebPageTranscoder.addFilesFromScriptElements (http://google.github.io/traceur-compiler/bin/traceur.js:32557:18)
    at WebPageTranscoder.selectAndProcessScripts (http://google.github.io/traceur-compiler/bin/traceur.js:32592:14)

It looks like we also need to include BrowserSystem for this to import successfully.

<script src="https://google.github.io/traceur-compiler/bin/traceur.js"></script>
<script src="https://google.github.io/traceur-compiler/src/bootstrap.js"></script>
<script src="https://google.github.io/traceur-compiler/bin/BrowserSystem.js"/>

Is this intentional, and if so does the wiki just need updating?

@johnjbarton
Copy link
Contributor

Yes this was intended and yes the wiki needs to be updated. Will you be able to do that?

I'm working on browser-based testing to prevent this from happening yet again.

@davie
Copy link
Author

davie commented Jan 7, 2016

OK, thanks - I've updated that page now.

@davie davie closed this as completed Jan 7, 2016
@arv
Copy link
Collaborator

arv commented Jan 7, 2016

Why don't we include BrowserSystem in bootstrap.js?

@arv arv reopened this Jan 7, 2016
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