google / traceur-compiler

Traceur is a JavaScript.next-to-JavaScript-of-today compiler
Apache License 2.0
8.17k stars 580 forks source link

ReferenceError: $traceurRuntime is not defined #1981

Open d180cf opened 9 years ago

d180cf commented 9 years ago

The code produced by traceur uses this variable (as well as Symbol.iterator which doesn't exist in es5), so when I try to run this code with node, I get this error. Here is an output from travis:

...
> tsumego.js@ test /home/travis/build/d180cf/tsumego.js
> cd tests; npm i; tsc --out es6.js; traceur --modules inline --out es5.js es6.js; node es5
...
/home/travis/build/d180cf/tsumego.js/tests/es5.js:37
      return ($traceurRuntime.createClass)(Pattern, {
              ^
ReferenceError: $traceurRuntime is not defined
...

Is there a setting that would tell traceur to generate a self-sufficient es5 script?

d180cf commented 9 years ago

Is there a way to inline this runtime if I want to get a self-sufficient .js file?

johnjbarton commented 9 years ago

You should be able to concatenate the runtime and inline files. On Aug 19, 2015 7:33 PM, "d180cf" notifications@github.com wrote:

Is there a way to inline this runtime if I want to get a self-sufficient .js file?

— Reply to this email directly or view it on GitHub https://github.com/google/traceur-compiler/issues/1981#issuecomment-132859203 .

d180cf commented 9 years ago

This will invalidate the source map.

fritx commented 9 years ago

+1 for this