1,013 B
Modules
ES2015 modules are supported in CoffeeScript, with very similar import
and export
syntax:
codeFor('modules')
Note that the CoffeeScript compiler does not resolve modules; writing an import
or export
statement in CoffeeScript will produce an import
or export
statement in the resulting output. It is your responsibility attach another transpiler, such as Traceur Compiler, Babel or Rollup, to convert this ES2015 syntax into code that will work in your target runtimes.
Also note that any file with an import
or export
statement will be output without a top-level function safety wrapper; in other words, importing or exporting modules will automatically trigger bare mode for that file. This is because per the ES2015 spec, import
or export
statements must occur at the topmost scope.