{"id":17295739,"url":"https://github.com/bnb/import-modules-as-esm-from-nodejs","last_synced_at":"2025-03-26T20:24:52.079Z","repository":{"id":74933391,"uuid":"274205473","full_name":"bnb/import-modules-as-esm-from-nodejs","owner":"bnb","description":"Code from my talk, import {modules} as esm from \"nodejs\"","archived":false,"fork":false,"pushed_at":"2020-06-22T17:49:06.000Z","size":5,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T05:11:15.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bnb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-22T17:48:38.000Z","updated_at":"2021-11-21T02:50:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"e692a878-9ca6-44e1-9a92-2b9d97f0606a","html_url":"https://github.com/bnb/import-modules-as-esm-from-nodejs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnb%2Fimport-modules-as-esm-from-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnb%2Fimport-modules-as-esm-from-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnb%2Fimport-modules-as-esm-from-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnb%2Fimport-modules-as-esm-from-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bnb","download_url":"https://codeload.github.com/bnb/import-modules-as-esm-from-nodejs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245729273,"owners_count":20662835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T11:11:05.409Z","updated_at":"2025-03-26T20:24:52.064Z","avatar_url":"https://github.com/bnb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `import {modules} as esm from \"nodejs\"`\n\nCode for my talk, going over modules and ESM in Node.js.\n\n## Contents\n\n- [**./conditional-exports**](./conditional-exports):\n  - Contains a relatively barebones example of using Node.js's [conditional exports](https://nodejs.org/api/esm.html#esm_conditional_exports) with ESM and CommonJS exports from a module (checked in to `node_modules`) and using them, respectively. Uses both implicit ESM and explicit ESM.\n- [**./explicit-esm**](./explicit-esm):\n  - Demonstrates explicit ESM in Node.js, using `.mjs` extensions for ESM files.\n- [**./implicit-esm**](./implicit-esm):\n  - Demonstrates implicit ESM in Node.js, using `\"type\": \"module\"` in the project's `package.json` and `.js` extensions for ESM files.\n\n## Definitions\n\n- ESM\n  - ECMAScript Modules, the moudle system that's built-in to JavaScript and defined by TC39.\n- Implicit ESM\n  - Implicit ESM is ESM in Node.js that uses `\"type\": \"module\"` as a property in `package.json`, which Node.js uses as an indicator to passively read all `.js` files as ESM rather than CommonJS (which Node.js defaults to or can be told to )\n- Explicit ESM\n  - Explicit ESM is ESM in Node.js that uses `.mjs` as its file extension. Node.js will automatically parse any file with .mjs as its file extension as ESM.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbnb%2Fimport-modules-as-esm-from-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbnb%2Fimport-modules-as-esm-from-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbnb%2Fimport-modules-as-esm-from-nodejs/lists"}