Skip to content
This repository has been archived by the owner on Oct 24, 2021. It is now read-only.

How to export a module variable in CoffeeScript #328

Merged
merged 2 commits into from Apr 1, 2016
Merged

How to export a module variable in CoffeeScript #328

merged 2 commits into from Apr 1, 2016

Conversation

fknipp
Copy link
Contributor

@fknipp fknipp commented Apr 1, 2016

Maybe there might be better places in the guide to put this information, but it should be written somewhere.

@stubailo
Copy link
Contributor

stubailo commented Apr 1, 2016

@fknipp can you add an entry to the changelog? https://github.com/meteor/guide#changelog

@fknipp
Copy link
Contributor Author

fknipp commented Apr 1, 2016

You're welcome :)

@stubailo
Copy link
Contributor

stubailo commented Apr 1, 2016

Thanks!

@stubailo stubailo merged commit 6d1f09c into meteor:master Apr 1, 2016
@fknipp fknipp deleted the patch-3 branch April 1, 2016 21:31
@GeoffreyBooth
Copy link
Contributor

I just stumbled across this. This section is just wrong. The syntax is not different in CoffeeScript; CoffeeScript supports the import and export keywords, nearly identically to ES2015. What this PR is referring to is CommonJS module.exports, though it’s confusing CommonJS’ global exports object with the export keyword in CoffeeScript/ES2015.

This was written up here: https://docs.meteor.com/packages/modules.html#CoffeeScript. Clearly that’s hard to find, so perhaps we can replace this section with a link to that one?

@abernix
Copy link
Contributor

abernix commented Apr 4, 2017

@GeoffreyBooth That sounds fine to me. Can you do a PR or shall I?

lorensr added a commit that referenced this pull request Apr 5, 2017
@lorensr
Copy link
Contributor

lorensr commented Apr 5, 2017

Thanks Geoffrey, fixed in abedc3b

@GeoffreyBooth
Copy link
Contributor

@lorensr Thanks for tackling this, I haven’t had time just yet. In that commit it looks like the exports.Lists = ListsCollection 'lists' example is still there, after the link you added. I would think that this should become export Lists = new ListsCollection 'lists' or similar, i.e. using the export keyword (and ES2015 modules) rather than exports (and CommonJS). Even for CoffeeScript I think we should be encouraging the import and export keywords, and ES2015 modules, over CommonJS. Backticks aren’t required anymore.

@lorensr
Copy link
Contributor

lorensr commented Apr 5, 2017

Oops thanks, fixed!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants