javascripttraceur

Traceur JS - window is not defined


I have an existing project that accesses some variables off of the window scope. changing them around is an option, but I'd like to understand why the following isn't working...

//test.js
window.alert('I work');
traceur test.js
// -> ReferenceError: window is not defined

Why does this happen and how can I fix it? I cannot import window nor could I find any reference to how to fix this through searching.


Solution

  • As it turns out, you need to specify and output file if you want to compile your files to target the browser.

    this command worked for me

    traceur --out compiled.js test.js