-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
esm modules documentation doesn't describe how to implement a module #28060
Comments
/to @nodejs/modules-active-members |
I'm new to contributing to Node.js but I can try to take point on this. |
The section https://nodejs.org/api/esm.html#esm_writing_dual_packages_while_avoiding_or_minimizing_hazards includes some example ES modules with exports. Admittedly that’s not the |
Fixes: nodejs#28060 PR-URL: nodejs#33168 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
I read https://nodejs.org/api/esm.html and found that while it had good/exhaustive coverage of
import
, it doesn't describe how toexport
a module. Unless I very much missed it, there is not even a single example of a ESM module.I know,
import
andexport
are part of the language base, and node's documentation doesn't cover the Javascript language. In this case, I think its necessary to at least have a single example, such as:Not having this makes the import docs hard to understand, they talk a lot about "exports" and "default exports", but without defining them.
Also, having read through ~600 lines of documentation on ECMAscript modules and still having to scrape the internet to figure out how to write one is not a great documentation experience :-).
The text was updated successfully, but these errors were encountered: