* Support ES2018 regex dotall flag * Test in Node 9 * Alphabetize regex flags * Split regex dotall test into its own file, use new feature detection method of loading it * Update docs to explain compatibility for ES2018 and newer Node features * Remove unnecessary paragraph
1.3 KiB
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 to transpile this ES2015 syntax into code that will work in your target runtimes, unless you know that your code will be executed by a runtime that supports ES modules. Node supports such modules only for files with .mjs extensions; you can generate such an extension via the coffee command for a single file via --output, as in coffee --compile --output index.mjs index.coffee. When compiling folders or globs, it is your responsibility to rename the generated .js files as needed.
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.