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

How to export a module variable in CoffeeScript - #328

Merged
stubailo merged 2 commits into
meteor:masterfrom
fknipp:patch-3
Apr 1, 2016
Merged

stubailo merged 2 commits into
meteor:masterfrom
fknipp:patch-3

Conversation

@fknipp

@fknipp fknipp commented Apr 1, 2016

Copy link
Copy Markdown
Contributor

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

@stubailo

stubailo commented Apr 1, 2016

Copy link
Copy Markdown
Contributor

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

@fknipp

fknipp commented Apr 1, 2016

Copy link
Copy Markdown
Contributor Author

You're welcome :)

@stubailo

stubailo commented Apr 1, 2016

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

abernix commented Apr 4, 2017

Copy link
Copy Markdown
Contributor

@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

lorensr commented Apr 5, 2017

Copy link
Copy Markdown
Contributor

Thanks Geoffrey, fixed in abedc3b

@GeoffreyBooth

Copy link
Copy Markdown
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

lorensr commented Apr 5, 2017

Copy link
Copy Markdown
Contributor

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.

5 participants