Title: esm modules documentation doesn't describe how to implement a module · Issue #28060 · nodejs/node · GitHub
Open Graph Title: esm modules documentation doesn't describe how to implement a module · Issue #28060 · nodejs/node
X Title: esm modules documentation doesn't describe how to implement a module · Issue #28060 · nodejs/node
Description: I read https://nodejs.org/api/esm.html and found that while it had good/exhaustive coverage of import, it doesn't describe how to export a module. Unless I very much missed it, there is not even a single example of a ESM module. I know, ...
Open Graph Description: I read https://nodejs.org/api/esm.html and found that while it had good/exhaustive coverage of import, it doesn't describe how to export a module. Unless I very much missed it, there is not even a ...
X Description: I read https://nodejs.org/api/esm.html and found that while it had good/exhaustive coverage of import, it doesn't describe how to export a module. Unless I very much missed it, there is not eve...
Opengraph URL: https://github.com/nodejs/node/issues/28060
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"esm modules documentation doesn't describe how to implement a module","articleBody":"I read https://nodejs.org/api/esm.html and found that while it had good/exhaustive coverage of `import`, it doesn't describe how to `export` a module. Unless I very much missed it, there is not even a single example of a ESM module.\r\n\r\nI know, `import` and `export` 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:\r\n```\r\nexport function whatever() {};\r\nexport function somethingElse() {};\r\nexport default {\r\n whatever,\r\n somethingElse,\r\n};\r\n```\r\n\r\nNot having this makes the import docs hard to understand, they talk a lot about \"exports\" and \"default exports\", but without defining them.\r\n\r\nAlso, 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 :-).\r\n\r\n\u003c!--\r\nThank you for reporting a possible bug in Node.js.\r\n\r\nPlease fill in as much of the template below as you can.\r\n\r\nVersion: output of `node -v`\r\nPlatform: output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows)\r\nSubsystem: if known, please specify the affected core module name\r\n\r\nIf possible, please provide code that demonstrates the problem, keeping it as\r\nsimple and free of external dependencies as you can.\r\n-->\r\n\r\n* **Version**: master/12\r\n* **Platform**: any\r\n* **Subsystem**: doc\r\n\r\n\u003c!-- Please provide more details below this comment. -->\r\n","author":{"url":"https://github.com/sam-github","@type":"Person","name":"sam-github"},"datePublished":"2019-06-04T17:33:15Z","url":"https://github.com/nodejs/node/issues/28060"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8861d9fd-c487-a409-aa00-9ae7e38ddd10 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 83DA:55AC6:792B4F:9D8AD8:6AED32A7 |
| html-safe-nonce | a6d3ebd899e1302efee1818cbdd33baf6e7cfb9ee9b14e41a7f1821258b5fca5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4M0RBOjU1QUM2Ojc5MkI0Rjo5RDhBRDg6NkFFRDMyQTciLCJ2aXNpdG9yX2lkIjoiNjA5MzU2MjYzNDg1MTY2MDQ1NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5f55500ce4c0381f5b8a36c8433aa62855bb6fd266ed36e6c3256a923e7244de |
| hovercard-subject-tag | issue:452120222 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/28060/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e13b80c42aea8c2cb2fabc166536cdbebe50212aec363709512ac2b3beafcc66/nodejs/node/issues/28060 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e13b80c42aea8c2cb2fabc166536cdbebe50212aec363709512ac2b3beafcc66/nodejs/node/issues/28060 |
| og:image:alt | I read https://nodejs.org/api/esm.html and found that while it had good/exhaustive coverage of import, it doesn't describe how to export a module. Unless I very much missed it, there is not even a ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sam-github |
| hostname | github.com |
| expected-hostname | github.com |
| None | e51d0b7b5ab34b1688c05b54c3ed17b8658b2fa9bca973a9c740683ccb12cf4a |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 59ebb7b901cc154ecc179a44f266fcf69f343b30 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width