CoffeeScript has been a first-class supported language since Meteor’s early days. Even though today we recommend ES2015, we still intend to support CoffeeScript fully.
As of CoffeeScript 1.11.0, CoffeeScript supports import
and export
statements natively. Make sure you are using the latest version of the CoffeeScript package in your project to get this support. New projects created today will get this version with meteor add coffeescript
. Make sure you don’t forget to include the ecmascript
and modules
packages : meteor add ecmascript
. (The modules
package is implied by ecmascript
.)
CoffeeScript import syntax is nearly identical to the ES2015 syntax you see above :
import { Meteor } from 'meteor/meteor'
import SimpleSchema from 'simpl-schema'
import { Lists } from './lists.coffee'
You can also use traditional CommonJS syntax with CoffeeScript.