Skip to content

Options for Compiling

Simon Menke edited this page Jul 15, 2014 · 16 revisions

Various options control which EcmaScript features are allowed in the source and what kind of output will be generated. The compile options are enumerated in options.js. You can experiment with the options in the [REPL page] (http://traceur-compiler.googlecode.com/git/demo/repl.html) using the Options control in the upper right corner.

The command line supports these options by using --optionName, as well as a few more options:

  Usage: traceur [options] [files]

  Options:

    -h, --help              output usage information
    --out <FILE>            Compile all input files into a single file
    --dir <INDIR> <OUTDIR>  Compile an input directory of modules into an output directory
    --source-maps           Generate source maps
    --longhelp              Show all known options
    -v, --version           Show version and exit
    --experimental          Turns on all experimental features
    --script <fileName>     Parse as Script (must precede modules)

  Examples:

    $ traceur a.js [args]
    $ traceur --out compiled.js b.js c.js
    $ traceur --dir indir outdir

Options for Modules

The default option is 'register'.

  • modules='amd': each input module creates an output file in AMD format. eg traceur --dir src/util test-amd/ --modules=amd
  • modules='commonjs': each input module creates an output file in ?
  • modules='instantiate': for systemjs bundling.
  • modules='inline': All dependencies of the root modules and/or scripts are compiled into a long script that creates modules upon execution then runs the dependents.
  • modules='register': All dependencies of the root modules and/or scripts are compiled in to functions that register the modules then execute any scripts.
Clone this wiki locally